Nessuna descrizione
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

smtp.htm 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. {include file="public/layout" /}
  2. <body class="bodystyle" style="overflow-y: scroll;min-width:auto;">
  3. <div id="toolTipLayer" style="position: absolute; z-index: 9999; display: none; visibility: visible; left: 95px; top: 573px;"></div>
  4. <div id="append_parent"></div>
  5. <div id="ajaxwaitid"></div>
  6. <div class="page min-hg-c-i" style="min-width: auto;box-shadow:none;">
  7. <div class="fixed-bar">
  8. <div class="item-title">
  9. {neq name='$goback' value='off'}
  10. <a class="back_xin" href="{:url('System/api_conf')}" title="返回"><i class="iconfont e-fanhui"></i></a>
  11. {/neq}
  12. <div class="subject">
  13. <h3>电子邮箱</h3>
  14. <h5></h5>
  15. </div>
  16. <ul class="tab-base nc-row">
  17. {eq name="'System@smtp'|is_check_access" value="1"}
  18. <li><a href="{:url('System/smtp')}" {if condition="'smtp'==$Think.const.ACTION_NAME"}class="current"{/if}><span>邮箱配置</span></a></li>
  19. {/eq}
  20. {eq name="'System@smtp_tpl'|is_check_access" value="1"}
  21. <li><a href="{:url('System/smtp_tpl')}" {if condition="'smtp_tpl'==$Think.const.ACTION_NAME"}class="current"{/if}><span>自定义模板</span></a></li>
  22. {/eq}
  23. </ul>
  24. </div>
  25. </div>
  26. <form class="form-horizontal" id="handlepost" method="post">
  27. <div class="ncap-form-default">
  28. <dl class="row">
  29. <dt class="tit">
  30. <label for="smtp_server"><em>*</em>SMTP地址</label>
  31. </dt>
  32. <dd class="opt">
  33. <input id="smtp_server" name="smtp_server" value="{$smtp.smtp_server|default=''}" class="input-txt" type="text" autocomplete="off" />
  34. <p class="notic2">发送邮箱的smtp地址。如: smtp.qq.com或smtp.gmail.com</p>
  35. </dd>
  36. </dl>
  37. <dl class="row">
  38. <dt class="tit">
  39. <label for="smtp_port"><em>*</em>SMTP端口</label>
  40. </dt>
  41. <dd class="opt">
  42. <input id="smtp_port" name="smtp_port" value="{if condition="isset($smtp['smtp_port'])"}{$smtp['smtp_port']|default=''}{else /}465{/if}" class="input-txt" type="text" autocomplete="off"/>
  43. <p class="notic2"><span style="color: red;">注意:大部分默认为465,具体请参看各STMP服务商的设置说明,极少部分是25或其他端口号。</span>
  44. </p>
  45. </dd>
  46. </dl>
  47. <dl class="row">
  48. <dt class="tit">
  49. <label for="smtp_user"><em>*</em>发信邮箱账号</label>
  50. </dt>
  51. <dd class="opt">
  52. <input id="smtp_user" name="smtp_user" value="{$smtp.smtp_user|default=''}" class="input-txt" type="text" autocomplete="off"/>
  53. </dd>
  54. </dl>
  55. <dl class="row">
  56. <dt class="tit">
  57. <label for="smtp_pwd"><em>*</em>邮箱授权码</label>
  58. </dt>
  59. <dd class="opt">
  60. <input id="smtp_pwd" name="smtp_pwd" value="{$smtp.smtp_pwd|default=''}" class="input-txt" type="text" autocomplete="off"/>
  61. <p class="notic2">使用发送邮件的邮箱授权码。具体请点击参看【<a href="JavaScript:void(0);" data-href="https://www.eyoucms.com/plus/view.php?aid=5552&origin_eycms=1" onclick="openFullframe(this,'获取邮箱授权码');">使用指南</a>】</p>
  62. </dd>
  63. </dl>
  64. <dl class="row">
  65. <dt class="tit"><em>*</em>管理员邮箱账号</dt>
  66. <dd class="opt">
  67. <input value="{$smtp.smtp_from_eamil|default=''}" name="smtp_from_eamil" id="smtp_from_eamil" placeholder="多个邮箱可以用逗号隔开" class="input-txt" type="text" onkeyup="this.value=this.value.replace(/,/g,',');" onpaste="this.value=this.value.replace(/,/g,',')" autocomplete="off">
  68. <input value="测试发送" class="input-btn" onclick="sendEmail();" type="button">
  69. <p class="notic">多个邮箱可以用逗号隔开</p>
  70. </dd>
  71. </dl>
  72. <dl class="row">
  73. <dt class="tit">接收提醒选项</dt>
  74. <dd class="opt">
  75. <ul class="nc-row ncap-waybill-list">
  76. <li style="width: 100%;">
  77. {foreach name="tpl_list" item="vo" key="k" }
  78. <label class="label">
  79. <input class="check" type="checkbox" name="tpl_id[]" value="{$vo.tpl_id}" {eq name="$vo.is_open" value="1" }checked="checked"{/eq}><span>{$vo.tpl_name}</span>
  80. </label>
  81. &nbsp;
  82. {/foreach}
  83. </li>
  84. </ul>
  85. </dd>
  86. </dl>
  87. <div class="bot">
  88. <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onclick="submit_smtp();">确认提交</a>
  89. </div>
  90. </div>
  91. </form>
  92. </div>
  93. <script type="text/javascript">
  94. var parentObj = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  95. // 提交邮箱配置
  96. function submit_smtp() {
  97. var smtp_server = $.trim($('input[name="smtp_server"]').val());
  98. var smtp_user = $.trim($('input[name="smtp_user"]').val());
  99. var smtp_pwd = $.trim($('input[name="smtp_pwd"]').val());
  100. var smtp_from_eamil = $.trim($('input[name="smtp_from_eamil"]').val());
  101. if (smtp_server != '' || smtp_user != '' || smtp_pwd != '' || smtp_from_eamil != '') {
  102. if (smtp_server == '') {
  103. showErrorMsg('邮件发送服务器不能为空!');
  104. $('input[name=smtp_server]').focus();
  105. return false;
  106. }
  107. if (smtp_user == '' || !checkEmail(smtp_user)) {
  108. showErrorMsg('邮箱账号的格式不正确!');
  109. $('input[name=smtp_user]').focus();
  110. return false;
  111. }
  112. if (smtp_pwd == '') {
  113. showErrorMsg('邮箱授权码不能为空!');
  114. $('input[name=smtp_pwd]').focus();
  115. return false;
  116. }
  117. if (smtp_from_eamil == '') {
  118. showErrorMsg('接收的邮件地址不能为空!');
  119. $('input[name=smtp_from_eamil]').focus();
  120. return false;
  121. }
  122. }
  123. layer_loading("正在处理");
  124. $.ajax({
  125. url: "{:url('System/smtp', ['goback'=>$goback,'_ajax'=>1])}",
  126. type: 'POST',
  127. dataType: 'JSON',
  128. data: $('#handlepost').serialize(),
  129. success: function(res) {
  130. layer.closeAll();
  131. if (1 == res.code) {
  132. layer.msg(res.msg, {shade: 0.1, time: 1000}, function(){
  133. window.location.reload();
  134. });
  135. } else {
  136. var icon = 5;
  137. try{
  138. if (res.data.icon) {
  139. icon = res.data.icon;
  140. }
  141. }catch(e){}
  142. showErrorAlert(res.msg, icon);
  143. }
  144. },
  145. error: function(e){
  146. layer.closeAll();
  147. showErrorAlert(e.responseText);
  148. }
  149. });
  150. }
  151. // 测试邮箱发送
  152. function sendEmail() {
  153. var email = $('#smtp_from_eamil').val();
  154. if (email == '') {
  155. showErrorMsg('接收的邮件地址不能为空!');
  156. $('input[name=smtp_from_eamil]').focus();
  157. return false;
  158. } else {
  159. var loading = layer_loading('正在发送');
  160. $.ajax({
  161. type: "post",
  162. data: $('#handlepost').serialize(),
  163. dataType: 'json',
  164. url: "{:url('System/send_email', ['_ajax'=>1])}",
  165. success: function (res) {
  166. layer.closeAll();
  167. if (res.code == 1) {
  168. layer.msg(res.msg, {icon: 1, time:1000});
  169. } else {
  170. layer.msg(res.msg, {icon: 2, time: 2000});
  171. }
  172. },
  173. error: function(e) {
  174. layer.closeAll();
  175. showErrorAlert(e.responseText);
  176. }
  177. })
  178. }
  179. }
  180. </script>
  181. {include file="public/footer" /}