A.White.89 Posted March 27, 2009 Share Posted March 27, 2009 I am working on sending an email to people using the php mail() function. So far, I have everything working great except that the received email has a large server address in the "From" column that won't change with the header, "From: person" . Here is an example of what I'm talking about: $recipient = '[email protected]'; $subject = 'email subject'; $message = 'email message...'; $header = 'From: InsertName\r\n'; mail($recipient, $subject, $message, $header); Everything in this example works correctly except the header. Any suggestions why this isn't working and how it can be fixed? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/151351-solved-from-header-in-mail/ Share on other sites More sharing options...
Daniel0 Posted March 27, 2009 Share Posted March 27, 2009 It has to be of the format From: Somebody <[email protected]> or just From: [email protected]. If it already is that then your MTA is overriding it and you won't be able to fix that. Quote Link to comment https://forums.phpfreaks.com/topic/151351-solved-from-header-in-mail/#findComment-794929 Share on other sites More sharing options...
A.White.89 Posted March 27, 2009 Author Share Posted March 27, 2009 Thanks for the response. It brings me to another question. Does the e-mail used in that location have to be a an actual e-mail account on the server or can it be a dummy? Quote Link to comment https://forums.phpfreaks.com/topic/151351-solved-from-header-in-mail/#findComment-794931 Share on other sites More sharing options...
Daniel0 Posted March 27, 2009 Share Posted March 27, 2009 You can usually write any address you want. Quote Link to comment https://forums.phpfreaks.com/topic/151351-solved-from-header-in-mail/#findComment-794933 Share on other sites More sharing options...
A.White.89 Posted March 27, 2009 Author Share Posted March 27, 2009 That worked great. I appreciate the help. Quote Link to comment https://forums.phpfreaks.com/topic/151351-solved-from-header-in-mail/#findComment-794936 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.