Sunday, February 28, 2016

Send PHP Email in HTML Format

PHP Email is one of the useful functions you can use to send email to one and more people. and you can also use this to send many emails, to people such as who submit a form or who contact you via blog or website.

So let,s see how to submit PHP EMAIL, Plain-Text Email in PHP
First you should know about the basic email functionality in PHP, 
you simply need some steps to be added in the email function something like below


$to = “receiver@gmail.com”;$subject = “Verify Your Email”;$message = “This is a message for you!”;$from = “sender@yahoo.com”;mail($to,$subject,$message,$from);

Above local variables hold some information and then we use the PHP, Email function easily. So, if you want to send a beautiful HTML & CSS formatted (Email) then you do so. Carry on reading.

Sending PHP Email with HTML & CSS Easily
You can use extra headers to send an email which contains HTML and CSS codes, and this will be actually applied on the page. 
Now below is the some code which you can take from here and can use in your site-projects, this will send the email to the user which is in the $to variable, and the email will be fully designed.


///////////------My Blogger Tools--------////////////$to = “someone@something.com;$subject = “Verify your email address.”;$message = ”<html>Hello <strong>John Doe</strong><h2>We are a company here in the USA</h2><marquee>We do business with clients</marquee><h3 style=’color:read;’>We welcome you to our website</h3></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”;$headers .= ‘From: <mbt@mybloggertools.com>‘ . “\r\n”;mail($to,$subject,$message,$headers);///////////------My Blogger Tools--------////////////

Above email is the perfect one with HTML and CSS (Web or blog) tags, you can change it according to your own information. 
But the important part in above email "syntax" is the ($headers variable) in which we’ve defined the version and content with character & set. So  this format will be treated as HTML email by the browser and email provider. 
You also can change the (from:<mbt@mybloggertools.com>) to your own email from which you want to send an email to someone.

If you have any questions about this tutorial or any other tutorial on this website then don’t hesitate to ask your question using below commenting area below this posts Thanks!

Previous Post
Next Post

21 comments:

  1. Such as very valuable information and it's very helpful in my carrier, I really appreciate the kind words.you are the master of content.
    sap basis training in chennai

    ReplyDelete
  2. its really very helpful to send the mail in PHP with HTML format. and its really good to know how to send with authorized commands.thanks for sharing. keep update.
    SEO Training in Chennai

    ReplyDelete
  3. your content is really great's sound ,it is implementing me to work more in this kind of information and it is a incredible work.


    digital marketing training in chennai

    ReplyDelete
  4. Thanks for your informative post!!! After completing my graduation, i am confused whether to choose web design as my career. Your article helped me to make a right choice. PHP Training in Chennai

    ReplyDelete
  5. Hire PHP programmer who customizes your website to the finest accuracy. PHP outsource can be done from a
    PHP development company which provides presence and sufficient impetus towards the growth of your business.
    Please visit us: php

    ReplyDelete


  6. Thanks for the good words! Really appreciated. Great post. I ve been commenting a lot on a few blogs recently, but I had nt thought about my approach until you brought it up.

    SAP training in Chennai

    ReplyDelete
  7. This could have been prevented if the user had been a bit more alert and monitored their gmail account activity regularly.create gmail account

    ReplyDelete
  8. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us.
    seo company in chennai

    ReplyDelete
  9. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.

    monkey go happy| yahtzee with buddies| | mahjong | | defendyournuts 2| superfighters 2 |

    ReplyDelete
  10. Thanks for giving the unique content, you have done a great job I appreciate your effort and I hope you will get more positive comments from the web users

    Dot Net training in chennai

    ReplyDelete
  11. nice blog too informative. looking and reading your points its so impressive. doing more blog like this. i really appreciated doing like this.
    Digital Marketing Course in Chennai

    ReplyDelete
  12. Very very informative stuff. keep it up.

    Mike Craig
    Internet marketer

    ReplyDelete
  13. Good post. I learned some new things. Thanks for sharing.

    php training in chennai

    ReplyDelete
  14. The blog was absolutely fantastic! Lot of great information which was helpful
    Best software testing training institute in velachery

    ReplyDelete