简体   繁体   English

如何在托管2个域的服务器上的外发PHP邮件上指定域?

[英]how can I specify the domain on outgoing PHP mail on a server hosting 2 domains?

My server is configured with example.net as the hostname, but both example.net and domain.com A records point to the IP. 我的服务器配置了example.net作为主机名,但是example.netdomain.com A记录均指向IP。

If you visit domain.com one of the pages sends an email out. 如果您访问domain.com其中一个页面会发送一封电子邮件。 I've tried this 我已经试过了

mail('my@email.com',
'an image (#' . $id . ') has been reported',
'an image (#' . $id . ') has been reported',
'From: reports@domain.com' . "\r\n" . 'Reply-To: reports@domain.com' . "\r\n" .
'Return-Path: reports@domain.com');

When sending it to my Live/Hotmail address, it gets sent to the junk folder, and this is what message source shows 将其发送到我的Live / Hotmail地址时,它将发送到垃圾文件夹,这是message source显示的内容

Authentication-Results: hotmail.com;
spf=none (sender IP is *.*.*.*) smtp.mailfrom=www-data@example.net;
dkim=none header.d=domain.com;
x-hmca=none header.id=reports@domain.com

From: reports@domain.com
Reply-To: reports@domain.com
Return-Path: www-data@example.net

If you're on a *nix server, using sendmail, then you can specify the sender used in the SMTP transmission by passing extra arguments to sendmail via the fifth parameter, eg: 如果您在* nix服务器上,使用sendmail,则可以通过第五个参数将额外的参数传递给sendmail ,从而指定SMTP传输中使用的发件人,例如:

mail('my@email.com',
'an image (#' . $id . ') has been reported',
'an image (#' . $id . ') has been reported',
'From: reports@domain.com' . "\r\n" . 'Reply-To: reports@domain.com' . "\r\n" .
'Return-Path: reports@domain.com',
'-freports@domain.com');

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

相关问题 使用PHP处理来自邮件服务器的传出邮件 - Process outgoing mail from mail server with PHP 如何在PHP中为电子邮件指定SMTP服务器? - How do I specify SMTP server for an e-mail in PHP? 如何向 PHP 指定应该使用外部邮件服务器发送 mail()? - How do I specify to PHP that mail() should be sent using an external mail server? 使用PHP,如何判断请求是否源自托管服务器? - Using PHP, how can I tell if a request originates on the hosting server? 使用同一网站空间托管两个域时,如何防止访问域子文件夹? - How do I prevent access to domain subfolders when hosting two domains using the same webspace? 如何通过 PHP 获取我通过 Google Domains 拥有的域名列表? 有我可以使用的 API 吗? - How can I get a list of domain names I own through Google Domains via PHP? Is there an API I can use? 如何使用 php 获取我的站点域和托管? - How do I get my site domain and hosting using php? 使用外发邮件服务器,用户名和密码验证从PHP发送电子邮件 - send email from PHP with outgoing mail server & userid and password authantication 如何使用HTML将.png添加到外发PHP电子邮件中? - How can I add a .png to an outgoing PHP Email with HTML? 如何在PHP中为fsockopen使用特定的传出IP? - How can I use specific outgoing IP for fsockopen in PHP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM