dongzh1988 2015-02-03 15:51
浏览 62

删除PHPMailer的From:127.0.0.1标题

When I'm sending emails via well-known UA's (such as Outlook, Roundcube...) everything is fine

but

when I try to send programmatic email by using PHPMailer I got trouble in sent message headers:

Received: from www.domain.tld (hostname.domain.tld [127.0.0.1])
    by hostname.domain.tld (Postfix) with ESMTP id C4D7232C14EB
    for <me@somedomain.com>; Tue, 3 Feb 2015 16:23:17 +0100 (CET)

where www.domain.tld is url of website where is my script located, hostname.domain.tld is, obviously, server's FQDN.

Here is my code:

$mail = new PHPMailer;
$mail->SMTPDebug = false;
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->From = 'samplesender@sampledomain.tld';
$mail->FromName = 'Some sender name';
$mail->addAddress($emailadresa, $ime);
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);                                 
$mail->Subject = 'Email subject';
$mail->Body = $htmlBody;
$mail->XMailer = ' ';

I've also noticed from www.domain.tld in headers which are not there when I send email via well-known UA's.

How to get rid of 127.0.0.1 headers when sending with PHPMailer?

  • 写回答

1条回答 默认 最新

  • dongou2019 2015-02-03 15:56
    关注

    Try using authentication:

    $mail->SMTPAuth   = true;
    $mail->Host       = XX;
    $mail->Port       = XX;
    $mail->Username   = XX;
    $mail->Password   = XX;
    

    This way, you are going to use the host of the email account

    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端