本文介绍了在Godaddy服务器上的PHPMailer设置是否正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚注册了一个godaddy服务器来测试我正在写的PHP脚本。我使用PHPMailer发送电子邮件,它使用godaddy电子邮件主机:relay-hosting.secureserver.net

I've just signed up for a godaddy server to test a PHP script I'm writing. I'm using PHPMailer to send a emails, it uses the godaddy email Host : relay-hosting.secureserver.net

问题是我想标记电子邮件从me@ gmail.com

The problem is that I would like to mark the email as from "me"@gmail.com

当我在AddReplyTo字段中使用我的gmail地址发送电子邮件时,收件人电子邮件帐户将其直接发送到垃圾文件夹。

When I've sent emails using my gmail address in the AddReplyTo field the recipient email account sends it straight to the Junk folder.

我知道这里有一个根本的问题,我发送冲突的标题,这可能是为什么它被放入垃圾文件夹。

I know there is a fundamental problem here, that I'm sending conflicting headers and this is probably why it gets put into the junk folder.

有人可以向我解释如何解决这个问题。谢谢。

Can someone please explain to me how I can resolve this. Thank you.

代码:

try {
    $mail = new PHPMailer(true);
    $mail->IsSMTP(); // Using SMTP.
    $mail->CharSet = 'utf-8';
    $mail->SMTPDebug = 2; // Enables SMTP debug information - SHOULD NOT be active on production servers!
    $mail->SMTPAuth = false; // Enables SMTP authentication.
    $mail->Host = "relay-hosting.secureserver.net"; // SMTP server host.

    $mail->AddReplyTo('[email protected]', 'Me');
    $mail->AddAddress('[email protected]', 'Them');
    $mail->SetFrom('[email protected]', 'Me');
    $mail->Subject = 'PHPMailer Test Subject via smtp, basic with authentication';
    $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
    $mail->MsgHTML("Hi, this is an test email");
    $mail->Send();
} catch (phpmailerException $e) {
    echo $e->errorMessage();
} catch (Exception $e) {
    echo $e->getMessage();
}


推荐答案

Alex有权利。您需要指定一个来自您域的地址,[email protected]。关于Pekka关于使用Google的服务器发送电子邮件的评论。与Go Daddy共享托管,您必须使用relay-hosting.secureserver.net发送。

Alex has it right. You will need to specify a from address that is on your domain, [email protected]. In regards to Pekka's comment about using Google's servers for email that will not work. With Go Daddy shared hosting you must use relay-hosting.secureserver.net to send from.

这篇关于在Godaddy服务器上的PHPMailer设置是否正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 04:10