Pages

Saturday, April 13, 2013

How to send an html formatted mail with php mail() function



To send an html formatted text or emailer with php mail function you need to put correct syntax and header information inside you mail function. The most important is to have the header information. Because header will tell your function that your email contain what format of text, for that you can use



$headers =  'MIME-Version: 1.0' . "\r\n" .
                 'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
                'From:'.$email . "\r\n" .
                        'Reply-To: '. $email . "\r\n" .
                        'X-Mailer: PHP/' . phpversion();

for a better explanation the example is as follows



You should type this manually, thats how you will learn :)


posted by honeyonsys

1 comment:

latchu kannan said...

Great article. The content you have shared is very interesting to read. It is just awesome.

About Me

Hi,My name is Harish Kumar.I am a web developer by profession.I am working in the same field since 2008. About my skills i am proficient in HTML,CSS,JAVASCRIPT/JQUERY/ ANGULAR,PHP,MYSQL,APACHE,LINUXAJAX, REST,etc...