PHP provide easy method to send HTML template inside mail function.Here am going to elaborate that with you
Here is the code
First you have to specify Content-type:text/html;charset=UTF-8 in header
see
$headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
Subject specify mail subject
see
$subject="Tutorialshore: HAPPY TO SHARE OUR NEW LOCATION WITH YOU";
Message specify HTML mail messgae
see
$message = "<html><body><h1>OUR NEW LOCATION</h1><p>Welcome you</p><p><img alt="Happy New Year 2018 Wishes" src="https://www.tutorialshore.com/wp-content/uploads/2018/08/google-map-1-1024x576.png" /></p></body></html>";
Here is the full code
$subject="Tutorialshore: HAPPY TO SHARE OUR NEW LOCATION WITH YOU"; $message = "<html><body><h1>OUR NEW LOCATION</h1><p>Welcome you</p><p><img alt="Happy New Year 2018 Wishes" src="https://www.tutorialshore.com/wp-content/uploads/2018/08/google-map-1-1024x576.png" /></p></body></html>"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= $this->from_mail. "\r\n"; mail("[email protected]",$subject,$message,$headers);
Output Mail templates
OUR NEW LOCATION
Welcome you