我正在尝试从我的网站向我的godaddy邮件和zoho邮件发送电子邮件,但它无法正常工作。 我在我的Gmail帐户上试了一下它的工作正常。 我正在使用phpmailer。 我的代码 -
require_once "PHPMailerAutoload.php";
//PHPMailer Object
$mail = new PHPMailer;
//From email address and name
$mail->From = "test@deltware.com";
$mail->FromName = "Himanshu Mishra";
$mail->addAddress("my godaddy webmail"); //Recipient name is optional
//Send HTML or Plain Text email
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
请帮忙!!!!!
答案 0 :(得分:1)
您的From
语法错误
而不是
$mail->From = "test@deltware.com";
$mail->FromName = "Himanshu Mishra";
应该是
$mail->setFrom('test@deltware.com', 'Himanshu Mishra');