简体   繁体   English

自定义php邮件功能发送的邮件中的from字段

[英]Customizing the from field in the mail sent from php mail function

Im using the following code to send mail from my php script running on my ubuntu server. 我使用以下代码从在我的ubuntu服务器上运行的php脚本发送邮件。

$to = "<receipients_email_id_here>";
$subject = "Hello";
$txt = "<Message Body>";
$headers = "From: Site Name <jims@mysite.com>\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

if(mail($to,$subject,$txt,$headers)){
    print "Sent";
}
else
{
    print "Failed";
}

When user receives the mail he sees "Site Name <jims@mysite.com>" in the from field. 当用户收到邮件时,他在发件人字段中看到"Site Name <jims@mysite.com>" I would like the from field to just show "Site Name" and also i want to add a hyperlink to it to point to my website. 我希望发件人字段仅显示“站点名称” ,并且我想向其添加超链接以指向我的网站。 Is this possible to do from the php code ? 从PHP代码可以做到吗?

Please Help Thank You 请帮忙谢谢

我认为这与接收器的客户端软件上的设置有关。

同意@Ahmad Hajjar,我认为这是不可能的,否则垃圾邮件发送者会喜欢它!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM