作者 邓超

smtp发送

@@ -162,12 +162,12 @@ class MailFun { @@ -162,12 +162,12 @@ class MailFun {
162 * @author:dc 162 * @author:dc
163 * @time 2023/4/11 9:12 163 * @time 2023/4/11 9:12
164 */ 164 */
165 - public static function sendEmail(array $data, array $email){ 165 + public static function sendEmail(array $data, array $email,$debug = false){
166 $smtp = self::getHostPort($email['smtp'],465); 166 $smtp = self::getHostPort($email['smtp'],465);
167 // 邮件对象 167 // 邮件对象
168 $mail = new PHPMailer(); 168 $mail = new PHPMailer();
169 //Server settings 169 //Server settings
170 - $mail->SMTPDebug = SMTP::DEBUG_OFF;//调试输出 SMTP::DEBUG_SERVER; //Enable verbose debug output 170 + $mail->SMTPDebug = $debug ? SMTP::DEBUG_SERVER : SMTP::DEBUG_OFF;//调试输出 SMTP::DEBUG_SERVER; //Enable verbose debug output
171 $mail->isSMTP(); //Send using SMTP 171 $mail->isSMTP(); //Send using SMTP
172 $mail->Host = $smtp['host']; //Set the SMTP server to send through 172 $mail->Host = $smtp['host']; //Set the SMTP server to send through
173 $mail->SMTPAuth = true; //Enable SMTP authentication 173 $mail->SMTPAuth = true; //Enable SMTP authentication