一开始我设置的是以qq邮箱发送但是失败了,最后又换成了163的SMTP的SSL发送也失败了最后改成了163.非SSL方式.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| include './PHPMailer-master/PHPMailerAutoload.php'; date_default_timezone_set('Asia/Shanghai');
$mail = new PHPMailer(); $mail->isSMTP(); $mail->Host = 'smtp.163.com'; $mail->SMTPAuth = true; $mail->Username = 'XXX@163.com'; $mail->Password = 'XXXX'; $mail->SMTPDebug = 0; $mail->From = 'XXX@163.com'; $mail->FromName = 'Radxa更新IP'; $mail->addAddress('XXXX@qq.com'); $mail->Port = 25; $mail->isHTML(true); $mail->Subject = '标题Radxa更新IP'; $mail->Body = '内容'; $mail->AltBody = 'text/html';
if (!$mail->send()) { echo '邮件发送失败!'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo '收件发送成功'; }
|
给自己留个备份.