Home php Mail function in PHP

Mail function in PHP

Author

Date

Category

from whom will come a message sent using the mail () function ? Nowhere can I find information about this.

In some cases, the sender adds in additional_headers , but it is so possible and anything to add, even if [email protected]


Answer 1, Authority 100%

If you mean the sender of the letter, then it will be as you specify it clearly. mail just transmits your mail server (most likely PostFix ) All data you are passing into a function.

This is just a tool that makes a request to the destination mail server, and what you specify it on your conscience. The worst thing that this black lists and spam lists may happen. Do not forget the same about dkim and SPF


Answer 2, Authority 67%

It all depends on the settings of your server. Usually in Linux for this, the Sendmail program is responsible as well as from HostName. If you use a paid hosting, then you can configure mail addresses in your account and send mail from them. Of course you can insert anything in the FROM parameter, but your HostName

will be visible in the letter headers


Answer 3, Authority 67%

Example –

& lt;? php mail ("[email protected]", "My Subject", "Line 1 \ Nline 2 \ Nline 3 "); ? & gt;

Additional headers of the letter (Additional Headers) can be used to specify the letter encoding, the address of the sender, return address and many other options. They must be separated by the transfer of strings: combination “\ r \ n”. For example, so:

& lt;? php mail ("[email protected]", "The Subject", $ message, "from : Webmaster @ example.com \ r \ n "
. "X-Mailer: PHP /". phpversion ()); ? & gt;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions