axiom82 Posted August 29, 2008 Share Posted August 29, 2008 Okay so I've read a few articles about PHP/HTML emails and can't seem to get my emails to display as HTML in Microsoft Outlook. I believe the issue is in the headers but I've included the mime version and content type which I thought was the only requirements to format the text as HTML. Any ideas on what might be wrong with my code? Thanks! <?php $email['sender']['name'] = 'John Smith'; $email['sender']['address'] = '[email protected]'; $email['recipient']['name'] = 'Jane Smith'; $email['recipient']['address'] = '[email protected]'; $email['subject'] = 'Registration Confirmation'; $email['message'] = ' <style type="text/css"> .msg { color:black; font-family:arial, helvetica; font-size:10pt; } .msg span { display:block; margin-bottom:16px; } .msg p { line-height:1.5em; text-indent:0.5in; } .msg hr { color:gray; height:1px; margin-bottom:16px; } .msg div { padding-left:0.5in; padding-bottom:16px; } .msg div span { margin-bottom:8px; } .msg div span a { color:blue; } </style> <div class="msg"> <span>' . $email['recipient']['name'] . ',</span> <p>Thank you for registering...etc, etc, etc...</p> </div> '; $email['headers'] = "From: {$email['sender']['name']} <{$email['sender']['address']}>\n"; $email['headers'] .= "Reply-To: <{$email['sender']['address']}>\n"; $email['headers'] .= "Return-Path: <{$email['sender']['address']}>\n"; $email['headers'] .= "X-Sender: <{$email['sender']['address']}>\n"; $email['headers'] .= "X-Mailer: PHP/" . phpversion() . "\n"; $email['headers'] .= "X-Priority: 1\n"; $email['headers'] .= "MIME-Version: 1.0\n"; $email['headers'] .= "Content-Type: text/html; charset=iso-8859-1\n"; mail ($email['recipient']['address'], $email['subject'], $email['message'], $email['headers']); ?> Link to comment https://forums.phpfreaks.com/topic/121826-solved-html-emails-with-php-mail-function/ Share on other sites More sharing options...
axiom82 Posted August 29, 2008 Author Share Posted August 29, 2008 Now that I'm looking at my post...do html emails require using the html and body tags? Link to comment https://forums.phpfreaks.com/topic/121826-solved-html-emails-with-php-mail-function/#findComment-628521 Share on other sites More sharing options...
axiom82 Posted August 29, 2008 Author Share Posted August 29, 2008 Looks like I answered my own question Link to comment https://forums.phpfreaks.com/topic/121826-solved-html-emails-with-php-mail-function/#findComment-629214 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.