PHPMailer 邮件服务器名称显示在发送的电子邮件的发件人行中

问题描述 投票:0回答:1

我有一个使用

PHP 8.1.2
的网站。我正在使用
PHPMailer
发送电子邮件。该网站托管在共享虚拟主机服务器上。一切正常,没有错误。但是,在发送的电子邮件中,邮件服务器的名称显示在
From
行中。即:
Living Muay Thai via server501.stormwire.com

我在使用 php 的

mail()
方法时看到了同样的事情。我的猜测是,这是
PHP
mail server
中的某种默认行为。有没有办法防止在
mail-serer name
中发送电子邮件时显示
PHP

我的代码:

//Import PHPMailer classes into the global namespace
//These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

//Load Composer's autoloader
require '../vendor/autoload.php';

//Create an instance; passing `true` enables exceptions
$mail = new PHPMailer(true);

//From email address and name 
$mail->From = "[email protected]"; 
$mail->FromName = "Living Muay Thai";
...
...
$mail->send();

//output in email sent
>> Living Muay Thai via server501.stormwire.com
phpmailer php-8.1
1个回答
0
投票

@Synchro 是对的。我使用共享虚拟主机服务:Stormwire.com。在 Cpanel >> Domans 中,选择域,然后选择 Manage。

Stormwire 具有我需要添加的代码,以从

via server501.stormwire.com
电子邮件中的
From
行中删除
mail()

我的域名的 DNS 不在 Stormwire 上,并且由另一个人拥有/控制。我联系了那个人并提供了更新 DNS 的说明。现在一切都好了。

© www.soinside.com 2019 - 2024. All rights reserved.