How to add html codes to email?

I created a script that sends an email automatically! My mail message is included in the following variable

$message 

But when I include html code like or something else, it does not display correctly in my mail!

+1
source share
2 answers

You can do something like:

 $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $subject = "Subject here"; $message = "email message here"; $sendMail = mail(" info@domain.com ", "$subject", "$message", "$headers" ); 
+3
source

If you use a mail command, make sure that you Set the correct headers, for example

$ = headings "From: $ from \ r \ n"; $ Headers = "Content-Type :. Text / html \ g \

mail ($ k, $ question, $ message, $ headers);

+2
source

All Articles