[英]Outgoing email address on server with Plesk
I have Plesk with a Network Solutions virtual server. 我有一个带有网络解决方案虚拟服务器的Plesk。 When my site sends out emails using PHP, the email header indicates that the message is coming from an address like this one:
当我的网站使用PHP发送电子邮件时,电子邮件标头指示消息来自以下地址:
anonymous@002a1c9.netsolvps.com
anonymous@002a1c9.netsolvps.com
How do I change this address? 如何更改此地址?
Using the PHP mail() command, you can set the envelope from address using the -f command, and you can include the from address in the message headers as well, like so: 使用PHP mail()命令,您可以使用-f命令设置来自地址的信封,并且还可以在邮件头中包含from地址,如下所示:
$to = "to@to.com";
$from = "from@from.com";
$subject = "subject";
$message = "this is the message body";
$headers = "From: $from";
$ok = @mail($to, $subject, $message, $headers, "-f " . $from);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.