当我尝试通过 phpmailer 发送邮件时,出现了一些错误。像这样:
SMTP -> 从服务器:250-m1.mydomain.com
250-PIPELINING
250-SIZE 15728640
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
客户端 -> SMTP:STARTTLS
SMTP -> 从服务器:220 2.0.0 准备启动 TLS
客户端 -> SMTP:EHLO localhost.localdomain
250-PIPELINING
250-SIZE 15728640
250-VRFY
250-ETRN
250-AUTH PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
SMTP -> 错误:服务器不接受身份验证: 535 5.7.8 错误:身份验证失败:身份验证机制无效
CLIENT -> SMTP: RSET
SMTP -> FROM SERVER:250 2.0.0 Ok
CLIENT -> SMTP: MAIL FROM:
SMTP -> FROM SERVER:250 2.1.0 Ok
CLIENT -> SMTP: RCPT TO:
SMTP -> FROM SERVER:554 5.7.1 : Relay access denied
SMTP -> ERROR: RCPT not accepted from server: 554 5.7.1 : Relay access denied
CLIENT -> SMTP: quit
SMTP -> FROM SERVER:221 2.0.0 再见
我的php代码是这样的:
<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 3;
$mail->SMTPSecure = "tls";
$mail->SMTPAuth = true;
$mail->Host = "m1.mydomain.com";
$mail->Port = 25;
$mail->Username = "service@mydomain.com";
$mail->Password = "password";
$mail->SetFrom('service@mydomain.com', 'service');
$mail->Subject = "Fine Design - Avise me";
$mail->Body = "This is very interest email for you";
$mail->AddAddress("to@domain.com","name");
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
echo "We're sorry, however, an error has occurred. You may manually e-mail us .";
return false;
} else {
echo "Thanks! Your message was successfully sent.";
return true;
}
?>
但是我可以通过foxmail和其他客户端发送邮件,有人可以给我一些建议吗?