Today, We want to share with you PHP Send Beautiful HTML Email Templates.In this post we will show you phpmailer html email template, hear for PHP Send HTML Email Template we will give you demo and example for implement.In this post, we will learn about How to Send Nice HTML Email with PHP with an example.
PHP Send Beautiful HTML Email Templates
There are the Following The simple About A STEP-BY-STEP GUIDE TO SENDING HTML EMAIL TEMPLATES USING PHP Full Information With Example and source code.
As I will cover this Post with live Working example to develop php send html email with images, so the how to send html table in email body in php is used for this example is following below.
Simple PHP HTML Templates
index.php
<?php $template = "We are {{name}}, and We work for {{company}}. We are {{peoples}}."; # Your HTML template tags + alternative_replace using PHP $alternative_replace = array( 'name' => 'Purple', 'company' => 'King', 'peoples' => 125 ); function bind_to_template($alternative_replace, $template) { return preg_replace_callback('/{{(.+?)}}/', function($matches) use ($alternative_replace) { return $alternative_replace[$matches[1]]; }, $template); } // We are Purple, and We are for King. We are 125. echo bind_to_template($alternative_replace, $template);
Example 2: how to send html table in email body in php
$to = '[email protected]'; $from = '[email protected]'; $fromName = 'viratkohali'; $subject = "Send HTML Email in PHP by IphoneTamil"; $body_data = ' <html> <head> <title>Welcome to IphoneTamil</title> </head> <body> <h1>Thanks you so much for latest subscribes with us!</h1> <table cellspacing="0" style="border: 3px dashed #3d3d3d; width: 100%;"> <tr> <th>your Name:</th><td>IphoneTamil</td> </tr> <tr style="background-color: #e0e0e0;"> <th>your Email:</th><td>[email protected]</td> </tr> <tr> <th>your Website:</th><td><a href="http://www.IphoneTamil.com">www.IphoneTamil.com</a></td> </tr> </table> </body> </html>'; $mail_head = "MIME-Version: 1.0" . "\r\n"; $mail_head .= "Content-type:text/html;charset=UTF-8" . "\r\n"; $mail_head .= 'From: '.$fromName.'<'.$from.'>' . "\r\n"; $mail_head .= 'Cc: [email protected]' . "\r\n"; $mail_head .= 'Bcc: [email protected]' . "\r\n"; if(mail($to, $subject, $body_data, $mail_head)){ echo 'Good Luck Your Email has sent successfully.'; }else{ echo 'Bad Luck Email was not sending or failed.'; }
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about php email template builder.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.