I just installed ssmtp to send email with LAMP on Ubuntu.
And a simple script like this:
<?php
$additional_headers = 'From: [email protected]' . "\r\n";
$res = mail('[email protected]','test','test body', $additional_headers);
var_dump($res);
?>
I received the email but the sender name will put as "nobody" , so it is using the user name "nobody"? How can I change it? I'm new in Ubuntu...
Thanks.
Try changing your "Extra Headers" to also include a 'Reply-to' header EG:
$additional_headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n";
The way you have it SHOULD work, according to the documentation, but distance can vary depending on which MTA (Mail Transport Agent) your using.
The doc page is here : http://php.net/manual/en/function.mail.php
Additional:
Be aware, that in a lot of mail systems, you need to provide a valid DNS address too. On my mail server running ubuntu, if I give the from header as a domain that cannot be looked up using a valid DNS, the recipient address will appear blank.