问题
I use this code to send mail in php :
mail($to,$subject,$message,$headers);
It works perfectly but if we check the mail's full header it's gonna show the server of the site which the mail has been sent with that. I want to know is there any possible way so that we can change the full header of that and show something else in the full header in the mail.
Thanks in advance
回答1:
All mail servers will add an Received
header row to the message. You can configure your own server(s) to not add such a header, and even to remove other such headers, but you cannot control the behavior of other mail servers. This means that the first server outside your environment will add the IP and hostname of your last server, and there is nothing you can do about it.
回答2:
No. You cannot change certain headers as these are added by mail servers during mail delivery (so if is out of your reach). You can add own headers to the mail, but smtpd will still add theirs.
PS: Do not use mail()
. Use something more sophisticated like PHPMailer or similar package.
回答3:
You can send whatever header you want when you send mail through any serivce/API but its up to the client (gmail, exchange, etc...) to show what kind of data to display. In addition, the SMTP server modifies or overrides header data that it deems essential.
Your header data essentially goes through at least 2 filter layers in its transit process.
来源:https://stackoverflow.com/questions/13433350/change-full-header-for-sending-mail-in-php