Check Out The Latest Themes And Exclusive Deals And Offers On Themes
In Our Deals For Web Developers Section
Join Today And Get All The 87 Themes In Just $69! Join Today
Send Beautiful Emails Using HTML And PHP
Tuesday, Mar 7, 2017
Emails is one of the major source of messaging and customer service and if your message is not eye catching it will not going to be read properly and you loose some of your customers and sales.So in this tutorial we will show you how to send beautiful emails using HTML and PHP.You may also like send email using SMTP and PHP Mailer.
To Send Beautiful Emails It Takes Only One Step:-
- Make a PHP file and define scripting,markup and styling
Step 1.Make a PHP file and define scripting,markup and styling
We make a PHP file and save it with a name email.php
<?php $to = "receiver_email"; $from = 'your_email'; $subject = "You Got Mail From TalkersCode"; $headers = "From: " . $from . "\r\n"; $headers .= "Reply-To: ". $from . "\r\n"; $headers .= "CC: your_email\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message = '<html><body>'; $message .= '<h1>Mail From TalkersCode - Thanks for Subscribing</h1>'; $message .= '<table width="100%"; style="border:1px solid grey;" cellpadding="15">'; $message .= "<tr><td>Home Page</td><td><a href='http://talkerscode.com'></a></td></tr>"; $message .= "<tr><td colspan=3>Dear Receiver_Name,</td><td>Thanks For Subscribing TalkersCode.com Now You can Access Much More And Premium Features.</td></tr>"; $message .= "</table>"; $message .= "</body></html>"; mail($to, $subject, $message, $headers); ?>
In this step we use php built in mail() function to send email.In this we insert some headers which is required to send HTML emails and then we use some HTML and styling in message to make our message more attractive.You can use any kind of markup in email but make sure to add there required headers otherwise your email is not going to be send.You may also like send mail with attachments using PHP.
Thats all, this is how to send beautiful Emails using HTML and PHP.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.