doa24uk Posted October 27, 2009 Share Posted October 27, 2009 Hi guys, Here's my code. Basically this sends a simple email & a script picks it up on the other end (the script has access to the inbox) and outputs the author. Obviously the author should ALWAYS be [email protected] with this script & it is .... maybe 3/10 times ... however the remaining 7 it defaults to a server allocated address - [email protected] Why is it doing this? Am I trying to send too many emails in a short space of time?? $message = "A simple Email" mail( "[email protected]", "Email Subject", $message, "From: [email protected]" ); Quote Link to comment https://forums.phpfreaks.com/topic/179228-solved-super-simple-mail-problem-no-reason-for-it-to-be-malfunctioning/ Share on other sites More sharing options...
bob2588 Posted October 27, 2009 Share Posted October 27, 2009 that code should work <?php $to = "[email protected]"; $from="[email protected]"; $subject = "Hi!"; $body = "Massage"; if (mail($to, $from, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/179228-solved-super-simple-mail-problem-no-reason-for-it-to-be-malfunctioning/#findComment-945621 Share on other sites More sharing options...
doa24uk Posted October 27, 2009 Author Share Posted October 27, 2009 hi, The emails were getting through it's just the sender was appearing incorrectly. It turns out that if you try and send a php mail() from a real existing address on the SAME server then it doesn't lookup the MX record correctly & so defaults to the server mail() daemon... weird but I got round it by using [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/179228-solved-super-simple-mail-problem-no-reason-for-it-to-be-malfunctioning/#findComment-945626 Share on other sites More sharing options...
bob2588 Posted October 27, 2009 Share Posted October 27, 2009 glad you got it bob Quote Link to comment https://forums.phpfreaks.com/topic/179228-solved-super-simple-mail-problem-no-reason-for-it-to-be-malfunctioning/#findComment-945627 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.