DarkRanger Posted May 5, 2010 Share Posted May 5, 2010 Seems like I'll just never stop having problems with the mail coming from my intraweb. At first I had troubles setting up the postfix server. And now I get my header info in my message body. Here is the code: $headers = "MIME-Version:1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=ISO-8859-1"."\r\n"; $headers .= 'From: [email protected]'."\r\n"; $to = "[email protected]"; $subject = "Support request"; $body = //HTML Code; mail($to, $subject,$body,$headers); Here is the mail I receive then: Content-type:text/html;charset=iso-8859-1 MIME-Version: 1.0 Message-Id: <[email protected]> Date: Tue, 4 May 2010 16:13:09 +0200 (SAST) Return-Path: [email protected] X-OriginalArrivalTime: 04 May 2010 14:12:59.0296 (UTC) FILETIME=[E67A1200:01CAEB93] Any help regarding this? I'm clueless. Link to comment https://forums.phpfreaks.com/topic/200761-header-info-showing-in-emails/ Share on other sites More sharing options...
monkeytooth Posted May 5, 2010 Share Posted May 5, 2010 $headers = 'MIME-Version: 1.0' . "\r\n"; //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'Content-type: text/html; charset=us-ascii' . "\r\n"; $headers .= 'From: [email protected]' . "\r\n"; $headers .= 'Reply-To: [email protected]' . "\r\n"; $headers .= '1\r\nX-MSMail-Priority: High' . "\r\n"; $headers .= 'X-Mailer: MonkeyTooth Mailer' . "\r\n"; not much difference I know.. but it works for me.. Also depends on your message format.. if your sending a message plain text the email client web based or otherwise may determin the email as plain text and if thats the case output the headers like that. Also if your using a 3rd party app like outlook or thunderbird the settings you have on them may output it like that as well.. aside from the headers above I also format my emails as such trimming out my excess crap.. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>' . $titlesubject . '</title> </head> <style type="text/css"> <!-- body { background: #edebea; } #wrapper { background: #fff; border: 4px solid #ddd; } --> </style> </head> <body> ' . $message_body. ' </body> </html> '; Link to comment https://forums.phpfreaks.com/topic/200761-header-info-showing-in-emails/#findComment-1053435 Share on other sites More sharing options...
DarkRanger Posted May 5, 2010 Author Share Posted May 5, 2010 what exactly are the last two headers for? And are they required? Link to comment https://forums.phpfreaks.com/topic/200761-header-info-showing-in-emails/#findComment-1053441 Share on other sites More sharing options...
DarkRanger Posted May 5, 2010 Author Share Posted May 5, 2010 bump... Link to comment https://forums.phpfreaks.com/topic/200761-header-info-showing-in-emails/#findComment-1053605 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.