Winter0Star Posted March 4, 2011 Share Posted March 4, 2011 I'm having an issue with sending HTML Emails. Here is my code, but nothing comes out right when it gets emailed. And my email client is set to view HTML. I can view other HTML emails just fine, but not these. Here is my code to send the email, just wondering whats wrong with it. Thanks for any suggestions. $full_email = $frm_to . '@scotthermanfitness.com'; //define the receiver of the email $to = $full_email; //define the subject of the email $subject = 'Form Submit - SHF ' . $to_text . ' (' . $frm_name . ')'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = "From: " . $frm_email . "\r\nReply-To: " . $frm_email; //add boundary string and mime type specification //$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; $headers .= " Content-type: text/html\r\n"; //begin of HTML message $message = $frm_content; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); Link to comment https://forums.phpfreaks.com/topic/229580-sending-html-emails/ Share on other sites More sharing options...
Muddy_Funster Posted March 4, 2011 Share Posted March 4, 2011 going to need to see what's inside $frm_content Link to comment https://forums.phpfreaks.com/topic/229580-sending-html-emails/#findComment-1182819 Share on other sites More sharing options...
Winter0Star Posted March 4, 2011 Author Share Posted March 4, 2011 Its just whatever the user types into the form. Maybe I'm missing tags? Link to comment https://forums.phpfreaks.com/topic/229580-sending-html-emails/#findComment-1182824 Share on other sites More sharing options...
Muddy_Funster Posted March 4, 2011 Share Posted March 4, 2011 All HTML has to be formated using tags, whether on a page or in an email. Link to comment https://forums.phpfreaks.com/topic/229580-sending-html-emails/#findComment-1182830 Share on other sites More sharing options...
Winter0Star Posted March 4, 2011 Author Share Posted March 4, 2011 Thanks, by adding the HTML the emails look great. One last thing. span tag are not showing up. My text colors use <span style="color: #ffff00; ">Test<s/pan>. So these not work in HTML emails? Link to comment https://forums.phpfreaks.com/topic/229580-sending-html-emails/#findComment-1182844 Share on other sites More sharing options...
jcbones Posted March 4, 2011 Share Posted March 4, 2011 Email programs are in serious need of some work. They don't seem to like CSS very much. I would try to use one of the universal colors suggested by W3. Link to comment https://forums.phpfreaks.com/topic/229580-sending-html-emails/#findComment-1182940 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.