我正在尝试通过phpmailer发送邮件与smtp,我的问题是电子邮件不发送到不同的域可以帮助我如何发送电子邮件到不同的域,例如我有我的域名xxxxx我试着发送到gmail它不发送它只发送与xxxxxx域名相关的电子邮件
显示错误:
SMTP - >错误:服务器不接受RCPT:554 5.7.1:拒绝中继访问 SMTP错误:以下收件人失败:a.raja@gmail.com邮件程序错误:SMTP错误:以下收件人失败:a.raja@gmail.com
SMTP服务器错误:5.7.1:拒绝中继访问
我的代码:
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
//$mail->SMTPAuth = true; // authentication enabled
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "xxxxxx.com";
$mail->Port = "25"; // or 587
$mail->IsHTML(true);
$mail->Username = "c@xxxxxx.com";
$mail->Password = "xxxxxx";
$mail->SetFrom("c@xxxxxx.com");
$mail->Subject = "Price Change Notification";
$mail->Body = "Test E-mail";
$mail->AddAddress("a.raja@gmail.com");
if(!$mail->Send()){
echo "Mailer Error: " . $mail->ErrorInfo;
}
else{
echo "Message has been sent";
}