Prevent PHP mail( ) from appending hostname to from address

Posted on 16th Feb 2014 by admin

Hey guys,

I want to be able to send texts to phones via email (since each phone has their own address), and for specifying the from, I want to specify my own number, is there a way to do this?

For example:

Code: $from = '7785555555';
if(mail($to, $subject, $message, "From: $from"))
echo "Mail sent";
If I do this, the From in the email will be 7785555555@hostname.com. Is there any way I can send it so that it doesn't auto append the host name?

Thanks

Other forums