PHP sends mail from 'nobody', how can I change it? Tipărire

  • 26

Setting a proper 'From' address is important so that replies, bounces, etc go back to an appropriate address rather than the 'nobody' account on our web servers.

The PHP mail() function can be referenced here:
http://www.php.net/manual/en/function.mail.php

The last two parameters to mail(), which are optional, are "additional_headers" and "additional_parameters". They can both be used to ensure a properly set 'From' address.

Example:
mail("target@address.com",
"subject",
"message",
"From: your@address.com",
"-fyour@address.com"
);

Replace "your@address.com" with something appropriate, but ensure that the "-f" is maintained.

There is also a handy PEAR package to facilitate mail operations in PHP. Check this page: http://pear.php.net/package/Mail


Răspunsul a fost util?

« înapoi