Browse Source

邮件处理

pull/1/head
pengda 9 months ago
parent
commit
12bfd887c6
  1. 2
      library/mail/class.phpmailer.php
  2. 9
      model/mBase.php

2
library/mail/class.phpmailer.php

@ -589,7 +589,7 @@ class PHPMailer {
/* Retry while there is no connection */
while($index < count($hosts) && $connection == false) {
$hostinfo = array();
if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
if(preg_match('/^(.+):([0-9]+)$/', $hosts[$index], $hostinfo)) {
$host = $hostinfo[1];
$port = $hostinfo[2];
} else {

9
model/mBase.php

@ -114,7 +114,7 @@ class mBase extends publicBase {
* @param string $title 邮件标题
* @param string $content 邮件内容
*/
public static function sendMail($emails, $title, $content) {
public static function sendMail($emails, $title, $content,$attr='') {
include_once SERVER_ROOT . '/library/mail/class.phpmailer.php';
$mail_name = array_rand($GLOBALS['notice_qqmail_list']);
@ -122,7 +122,8 @@ class mBase extends publicBase {
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'smtp.163.com';
$mail->Port = 465;
$mail->Port = 587;
$mail->SMTPSecure = 'tls'; // 启用 TLS 加密
$mail->Username = $mail_name;
$mail->Password = $GLOBALS['notice_qqmail_list'][$mail_name];
$mail->From = $mail_name;
@ -132,6 +133,10 @@ class mBase extends publicBase {
$mail->ClearAddresses();
$mail->SetLanguage('en', SERVER_ROOT . '/library/mail/language/');
if($attr){
$mail->addAttachment($attr);
}
$mail->FromName = "快乐论文";
foreach($emails as $email) {
$mail->AddAddress($email);

Loading…
Cancel
Save