JakkkeM Posted January 3, 2013 Share Posted January 3, 2013 Hi all, I'm sending an email with php as a part of my user registration process, and for some reason the mail script begins to fail when I use my full desired email in my headers. I use the standard PHP Manual headers for email: // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Jake M*** <**********@gmail.com>' . "\r\n"; $headers .= "From: CFS <noreply@crossfitst.com>" . "\r\n"; Now, if I make my last header: $headers .= "From: CFS <noreply@crossfitstmarys.com>"."\r\n"; It fails! As soon as I put the m in on CrossfitStMarys it fails the whole script. Any ideas? Cheers. P.S. I have real data in for my Jake M, just censored it out because I don't want everyone having my email haha. Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/ Share on other sites More sharing options...
trq Posted January 3, 2013 Share Posted January 3, 2013 Is crossfitstmarys.com the domain of the server you are actually sending the email from? What exactly do you mean by "It Fails!" ? Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402986 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 Not at the moment it's not - but I'm using all different address' and it works. I.e. crossfit.com worked I have: if(mail($to, $subject, $message, $headers)){ echo "YES"; }else{ echo "NO"; } To debug. Seems to work fine. Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402991 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 By fail - echo no and not send the email. Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402992 Share on other sites More sharing options...
Muddy_Funster Posted January 3, 2013 Share Posted January 3, 2013 what's a vardump of the $headrs look like for each of one of the working examples and the non working example? Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402994 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 Tried that. The only "unusual" thing, was I expected it to print the <noreply@crossfitstmarys.com.au> on the page, but it gets eaten for some reason. Nothing unexpected anywhere else. Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402995 Share on other sites More sharing options...
Muddy_Funster Posted January 3, 2013 Share Posted January 3, 2013 getting to see that output could help us here Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402997 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 Link Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402998 Share on other sites More sharing options...
Muddy_Funster Posted January 3, 2013 Share Posted January 3, 2013 I tested the output and got this in the view source : string(138) "MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 To: Jake M*** <**********@gmail.com> From: CFS <noreply@crossfitst.com> " string(142) "MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 To: Jake M*** <**********@gmail.com> From: CFS <noreply@crossfitstmary.com> " nothing being eaten anywhere Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1402999 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 None-the-less it's still not sending the message for some abstract reason... Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1403004 Share on other sites More sharing options...
Muddy_Funster Posted January 3, 2013 Share Posted January 3, 2013 I seen in the image you popsted that you had changed the From text as well as the address, I assume you have tried it both ways? Also, the other dmains that you are testing it from - do they exist? are they real domains or just something you made up? have you tried the script from a server that has an MX record pointing to it from the actuial domain? if you have access to the domain name settings you can just point an MX record at your dev box's global IP tempereraly for testing purposes. Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1403007 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 Tried fake addresses, huge address' and all sorts... For some reason, on some address' it removes the from header completely! There doesn't appear to be any other patterns... Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1403010 Share on other sites More sharing options...
Muddy_Funster Posted January 3, 2013 Share Posted January 3, 2013 you got me beat. It's just a shame that mail() doesn't do any really usefull error capturing. mybe you would be as well using the phpmailer lib? Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1403012 Share on other sites More sharing options...
JakkkeM Posted January 3, 2013 Author Share Posted January 3, 2013 Yeah I'll give it a try. It's so confusing because it seems so random... I thought perhaps there was a character limit on the whole from header but it doesn't appear to have one. Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1403077 Share on other sites More sharing options...
jazzman1 Posted January 3, 2013 Share Posted January 3, 2013 (edited) It's just a shame that mail() doesn't do any really usefull error capturing. It does, there are log files into the server. EDIT: By default a php mail function use a linux client called - sendmail. Edited January 3, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/272647-a-mail-bug/#findComment-1403082 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.