0

im using the php mail() function to send an email and i got the email. except its formatted wrong like it looks like this:

<table bgcolor="black"><tr bgcolor="#111111"><td bgcolor="#222222"
width="60%"

etc.. u get it right?
i use gmail. now ive had images sent in mails to me. so why is this not working? i havent tested images but i figure that if table doesnt work img wont either. whats going on? is there a workaround? or is this what all mail sent by php mail() is bound to look like.

i have free hosting atm. or is it the hosting?
im clueless halp?!

3
Contributors
4
Replies
6
Views
8 Years
Discussion Span
Last Post by SKANK!!!!!
0

Try following code

<?php
	$headers= "MIME-Version: 1.0\n";
	$headers.="Content-type: [b]text/html;[/b] charset=iso-8859-1\n";
	$headers.="cc: cc@daniweb.com\n";				
	$tomail="tosomeone@daniweb.com";

	$message="<bold>This is message for email</bold>\n\n<br><br>";
	$message.="<i>Nb : This message may be written in complete html format .</i>";
	mail($tomail,"This is mail subject ",$message,$headers);

?>

Edited by urtrivedi: n/a

0

no brainer? LOL i didnt know that i had to format the headers that way! btw is there different charsets and content types?

0

no brainer? LOL i didnt know that i had to format the headers that way! btw is there different charsets and content types?

If you send it without headers the email will read it as plaintext and not render any html, with the above headers it lets the program know that there is html to be rendered in this document.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.