dongyue9864 2014-11-29 04:00
浏览 226


I am having a SPF issue sending automatic email to users that register to my website.

When looking at the "original" email in gmail I got the following message with my Cpanel and hostname details instead of the email I sent the email from and my website name. When sending manual emails using webmail it is working just fine.

Here is what I get from Gmail


Received: by with SMTP id js7csp261337oab;
        Fri, 28 Nov 2014 18:37:45 -0800 (PST)

X-Received: by with SMTP id oz9mr78655916pdb.46.1417228665423;
        Fri, 28 Nov 2014 18:37:45 -0800 (PST)

Return-Path: <cpanel_login@hostname>

Received: from hostname (hostname [ip address*)
        by with ESMTPS id gb9si5051542pac.60.2014.
        for <>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 28 Nov 2014 18:37:45 -0800 (PST)

Received-SPF: none ( cpanel_logim@hostname does not designate permitted sender hosts) client-ip=ip address;

       spf=none ( cpanel_login@hostname does not designate permitted sender hosts) smtp.mail=cpanel_login@hostname

Received: from cpanel_login by hostname with local (Exim 4.82)
    (envelope-from <cpanel_login@hostname>)
    id 1XuXun-00065P-Hb
    for; Fri, 28 Nov 2014 18:37:44 -0800


Subject: Activate your account

X-PHP-Script: for

From: "Mywebsite" <>

Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bitReturn-Path: <>
Message-Id: <E1XuXun-00065P-Hb@hostname>
Date: Fri, 28 Nov 2014 18:37:41 -0800

To send the email I am using the php mail function

mail($useremail, $subject, $emailBody, $headers);

Any idea about what am I missing? Cheers

  • 写回答

2条回答 默认 最新

  • douyi0219 2014-11-29 04:08

    If you send email this way the host server will use the default address for your account as a return path. You can try adding a fifth parameter to mail() like this:

    mail($to, $subject, $body, $headers, '-f'.$returnAddress);

    where $returnAddress is the same as your From: address.

    It's not guaranteed as some systems flag the fact that you've used the -f parameter as a spam indicator.

    In any case, you're far better making life easier by using PHPMailer to do the job

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 编写vba代码实现数据录入工作
  • ¥15 做过TCL海信电视小米电视相关影视会员软件私我
  • ¥15 Mapreduce是正常的,在运行其他jar包时并没有任何问题,只是在做LogCount.jar 时出的问题。如图所示
  • ¥15 ImportError: DLL load failed while importing _iterative: 找不到指定的模块。
  • ¥15 如何通过交互分析得出某高危患者对放疗获益更多
  • ¥15 相关性分析中,p<0.05, r=0.29,怎么评价相关性呢
  • ¥15 docker部署Mongodb后输入命令报错?
  • ¥15 将下列流程图转变成python程序代码
  • ¥15 我需要全国每个城市的最新小区名字等数据。
  • ¥15 开发一个小区生态的小程序