我想通过godaddy帐户从我的网站发送电子邮件几天。 我不知道是否有任何特殊的配置在服务器端(godaddy) 我不知道我的php代码是否有任何错误。 我真的需要弄清楚如何发送电子邮件。 谢谢,里卡多。如何通过PHPMailer通过godaddy发送电子邮件?
enter code here
try {
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
$mail->DKIM_domain = '**********';
$mail->Debugoutput = 'html';
$mail->Host = "a2plcpnl0321.prod.iad2.secureserver.net";
$mail->Port = 465;
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "***************.com";
//Password to use for SMTP authentication
$mail->Password = "**99KKll";
$mail->SMTPSecure = 'ssl';
//Set who the message is to be sent from
$mail->setFrom('****************.com', '*******');
//Set an alternative reply-to address
//$mail->addReplyTo('[email protected]', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('**************.com', '*****');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
$mail->Body = "<i>This is the Link to change your password:</i>";
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
print_r($mail);
所以....'$ MAIL-> ErrorInfo'产生什么?请分享你的秘密 – MonkeyZeus