【问题标题】:Unable to send email from godaddy server to godaddy or zoho mail无法从 godaddy 服务器发送电子邮件到 godaddy 或 zoho mail
【发布时间】:2016-12-11 15:29:17
【问题描述】:

我正在尝试将电子邮件从我的网站发送到我的 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";
}

请帮忙!!!!!!

【问题讨论】:

  • 你能发布完整的代码吗?似乎它不是完整的代码。 Zoho & godaddy 对 phpmailer 有不同的设置,你想用什么?

标签: php email server


【解决方案1】:

您的From 语法错误 而不是

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

应该是

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

查看此链接https://github.com/PHPMailer/PHPMailer

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多