-2

I would like to insert some html in the email that my php file generate after a form. Here the part of the email:

mail($email, 
     "www.icecream-icecream.com", 
     "Thank you for your message,
           within 24 hours you will receive a personally dedicated email. Bye",
      "From: info@...."
   );

Where You can read "thank you for your message..." I would like basic customize with html. Why? Because I want to insert Thai characters that without html will not properly send.

Thanks if you know how to do it, thanks anyway if don't know. I am very new here.

Meenesh Jain
  • 2,532
  • 2
  • 19
  • 29
Massimiliano Rubino
  • 279
  • 1
  • 2
  • 16

1 Answers1

1
<?php
$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";
$message = "<html><head><title>HTML email</title></head><body><p></p></body></html>";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <webmaster@example.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";
mail($to,$subject,$message,$headers);
?>

This way you may put the html in the $message. Reference

varunsinghal
  • 329
  • 4
  • 12
  • 1
    Perfect! Thanks for help. I did Google around and also in this forum and I do admit there were similar answers. But maybe the way Varunsinghal expose the code was the only one I could apply to my case or maybe I was not just well prepared to understand others solutions. This was really clear. Great! – Massimiliano Rubino Jul 08 '15 at 09:45