无法从godaddy服务器向godaddy或zoho邮件发送电子邮件

时间:2016-08-05 09:07:51

标签: php email server

我正在尝试从我的网站向我的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";
}

请帮忙!!!!!

1 个答案:

答案 0 :(得分:1)

您的From语法错误 而不是

$mail->From = "test@deltware.com";
$mail->FromName = "Himanshu Mishra";

应该是

$mail->setFrom('test@deltware.com', 'Himanshu Mishra');

点击此链接https://github.com/PHPMailer/PHPMailer