TapeGun007 Posted September 20, 2010 Share Posted September 20, 2010 $headers = "From: [email protected]\r\n" . "Reply-To: [email protected]\r\n" . "BCC: ".$bcc."\r\n" . "Content-type: text/html\r\n"; The email sends fine, it's a form that you input some information into and it collects all the emails of the people that need to be notified. The only issue is that it's not in HTML. So, if in the email you send a <b> or <p>, it actually shows up in the email instead of actually make the text BOLD or whatever. Am I using the Content-type wrong? Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/ Share on other sites More sharing options...
the182guy Posted September 20, 2010 Share Posted September 20, 2010 Have you tried this on different email clients, and checked that text-only is not enabled on your client? Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113348 Share on other sites More sharing options...
fortnox007 Posted September 20, 2010 Share Posted September 20, 2010 I assume your message content includes also the html tags? like: $message = <<<fatmonkeys <html> <body bgcolor="#DCEEFC"> <b>blablabla</b> </body> </html> fatmonkeys; Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113349 Share on other sites More sharing options...
TapeGun007 Posted September 20, 2010 Author Share Posted September 20, 2010 Using Outlook 2007 and I get HTML emails all the time. No, the email being sent does NOT include the <body> tags and all that... I assumed it was sent... maybe that's the issue. For whatever reason, I just assumed that was already there and oddly enough, didn't think of it. duh >.< Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113352 Share on other sites More sharing options...
fortnox007 Posted September 20, 2010 Share Posted September 20, 2010 I dont use outlook, but if you would use php to sent mail. you need to include what i just showed otherwise you will have a freaky looking email. Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113356 Share on other sites More sharing options...
fortnox007 Posted September 20, 2010 Share Posted September 20, 2010 Might wanna try the stuff below. <?php //change this to your email. $to = "[email protected]"; $from = "[email protected]"; $subject = "HTML email from fatmonkeys"; //begin of HTML message $message = <<<fatmonkeys <html> <body bgcolor="#DCEEFC"> </body> </html> fatmonkeys; //end message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; //send the email. mail($to, $subject, $message, $headers); echo "Message from fat monkeys has been sent"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113363 Share on other sites More sharing options...
TapeGun007 Posted September 20, 2010 Author Share Posted September 20, 2010 Actually... what you suggested didn't work, but I now know WHY. I'm using a Javascript text editor, I use it in several places on my website. For some reason, the form that submits the text for the created email is stripping all the HTML tags. For example, I use the text editor to update the front page news. So if someone highlights a word and makes it bold on the screen, it writes that information to the db as HTML code. But for some reason on this email form, it is removing all the HTML code. Not sure why, it's the exact same text editor... I'll have to review my other code to see what I did there I guess. Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113372 Share on other sites More sharing options...
fortnox007 Posted September 20, 2010 Share Posted September 20, 2010 yeah or ditch the editor, the script i gave works as is. Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113376 Share on other sites More sharing options...
TapeGun007 Posted September 20, 2010 Author Share Posted September 20, 2010 yeah or ditch the editor, the script i gave works as is. I wish it were that easy. The people writing the emails are not HTML knowledgeable. They don't know what <b> does. So I have a WYSIWYG editor that works well on every other part of the site. Like I have a calendar, and if they put an event on there in bold, it simply shows up as bold on the calendar. They aren't having to code it. In this case, they need to be able to create bold items, bulleted items and such. I wanted to make the email form very user (and HTML ignorant) friendly. Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113381 Share on other sites More sharing options...
fortnox007 Posted September 20, 2010 Share Posted September 20, 2010 Well in that case, you could of course allow them to use the html code, But automatically add <html><body> to the beginning and </body></html> to the end for there input. That way they can do as they like in the body and not fack up your html email. Do realise that some html tags wont work very well in email. If you have questions or need help let me know. Like to see what you did in the end Quote Link to comment https://forums.phpfreaks.com/topic/213912-html-email/#findComment-1113390 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.