Letterbomb05 Posted August 3, 2008 Share Posted August 3, 2008 Hi, $to = $_POST['email']; $subject = "You have registered"; $body = " <html> <head> <title>Account Activation</title> </head> <body> <p>email here <br /> <br /> -----------------------------<br /> This is an automated email, please don't try and reply.' </body> </html>"; $headers = 'MIME-Version: 1.0' . "\r\n\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n\n"; $headers .= 'To: '.$username.' <'.$to.'>' . "\r\n"; $headers .= 'From: website.com <[email protected]>' . "\r\n\n"; $headers .= 'Cc: [email protected]' . "\r\n\n"; $headers .= '[email protected]' . "\r\n\n"; mail($to, $subject, $body, $headers); My problem here is with the headers. I've followed the manual to using mail() on php.net it just doesn't seem to work! Notice I have '\n\n' on the end of each header, if i only use one \n, the email doesn't send atall, however with the two, the email DOES send but with issues. The problem is that when I recieve the email, the headers are simply displayed at the top of the email, they arn't actually put into use :X Thanks in advance for any help Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/ Share on other sites More sharing options...
PHPTOM Posted August 3, 2008 Share Posted August 3, 2008 $to = $_POST['email']; $subject = "You have registered"; $body = " <html> <head> <title>Account Activation</title> </head> <body> <p>email here <br /> <br /> -----------------------------<br /> This is an automated email, please don't try and reply.' </body> </html>"; $headers = 'From: website.com <[email protected]>'; mail($to, $subject, $body, $headers); What happens if you do that? ---------------- Now playing: Linkin Park - Crawling Demo via FoxyTunes Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606723 Share on other sites More sharing options...
Letterbomb05 Posted August 3, 2008 Author Share Posted August 3, 2008 sorry I was playing xbox lol i'l test that, give me a few mins and then i'll edit this post EDIT: The email sends and the header works. Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606738 Share on other sites More sharing options...
PHPTOM Posted August 3, 2008 Share Posted August 3, 2008 Good to hear. Mark this thread as solved. ---------------- Now playing: Linkin Park - P5hng me A*wy via FoxyTunes Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606752 Share on other sites More sharing options...
Letterbomb05 Posted August 3, 2008 Author Share Posted August 3, 2008 I need all the headers? Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606764 Share on other sites More sharing options...
cooldude832 Posted August 3, 2008 Share Posted August 3, 2008 I need all the headers? You really can never had too many good headers that is what email servers read when they decide to allow a message in or bounce it 'MIME-Version: 1.0' . "\r\n\n"; Important and always required 'Content-type: text/html; charset=iso-8859-1' . "\r\n\n"; Required for your html message 'To: '.$username.' <'.$to.'>' . "\r\n"; Again important From: website.com <[email protected]>' . "\r\n\n"; Important 'Cc: [email protected]' . "\r\n\n"; Not really important '[email protected]' . "\r\n\n"; Not really important Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606766 Share on other sites More sharing options...
Letterbomb05 Posted August 3, 2008 Author Share Posted August 3, 2008 yes but how should I put all the headers in, should i use the method I first used like so: headers .= 'blabla'; headers .= 'blabla'; Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606769 Share on other sites More sharing options...
cooldude832 Posted August 3, 2008 Share Posted August 3, 2008 the \r\n (only 1 \n is required) are necessary because servers read headers separated by break lines and unix new lines are one of those (I think \r) and windows are \n so you need to make both server types happy. As for what you wrote the connotation isn't needed on the first instant of $header (the .= should just be $header =) I really don't know what you are asking? http://en.wikipedia.org/wiki/E-mail the image there shows you why headers are important Link to comment https://forums.phpfreaks.com/topic/117942-mail-issue/#findComment-606792 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.