{"id":735,"date":"2014-04-25T09:10:54","date_gmt":"2014-04-25T13:10:54","guid":{"rendered":"http:\/\/www.searchenginegenie.com\/programming-blog\/?p=735"},"modified":"2014-05-16T08:23:17","modified_gmt":"2014-05-16T12:23:17","slug":"send-an-html-email-using-php","status":"publish","type":"post","link":"https:\/\/www.searchenginegenie.com\/programming-blog\/send-an-html-email-using-php\/","title":{"rendered":"Send an HTML Email Using PHP"},"content":{"rendered":"<p><strong>PHP Mail Function:<\/strong><\/p>\n<p>The mail() function allows you to send emails directly from a script.<\/p>\n<p><strong>Syntax For E-mail:<\/strong><\/p>\n<p><strong>\u00a0mail($to,$subject,$message,$headers);<\/strong><\/p>\n<p>[php]<br \/>\n&lt;?php<br \/>\n$to = &quot;someone@example.com, someoneelse@example.com&quot;;<br \/>\n$subject = &quot;HTML email &quot;;<br \/>\n$message = &quot;&lt;table&gt;&lt;tr&gt;&lt;td&gt;Congrats&lt;\/tr&gt;&lt;\/td&gt;&lt;\/table&gt;&quot;;<br \/>\n\/\/ Always set content-type when sending HTML email\/\/Very Very Important headers&lt;\/h4&gt;<br \/>\n$headers = &quot;MIME-Version: 1.0&quot; . &quot;\\r\\n&quot;;&lt;\/h4&gt;<br \/>\n$headers .= &quot;Content-type:text\/html;charset=UTF-8&quot; . &quot;\\r\\n&quot;;\/\/ More headers&lt;\/h4&gt;<br \/>\n$headers .= &#8216;From: &amp;lt;webmaster@example.com&amp;gt;&#8217; . &quot;\\r\\n&quot;;<br \/>\n$headers .= &#8216;Cc: mymd@example.com&#8217; . &quot;\\r\\n&quot;;<br \/>\nmail($to,$subject,$message,$headers);<br \/>\n?&gt;<br \/>\n[\/php]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP Mail Function: The mail() function allows you to send emails directly from a script. Syntax For E-mail: \u00a0mail($to,$subject,$message,$headers); [php] &lt;?php $to = &quot;someone@example.com, someoneelse@example.com&quot;; $subject = &quot;HTML email &quot;; $message = &quot;&lt;table&gt;&lt;tr&gt;&lt;td&gt;Congrats&lt;\/tr&gt;&lt;\/td&gt;&lt;\/table&gt;&quot;; \/\/ Always set content-type when sending HTML email\/\/Very Very Important headers&lt;\/h4&gt; $headers = &quot;MIME-Version: 1.0&quot; . &quot;\\r\\n&quot;;&lt;\/h4&gt; $headers .= &quot;Content-type:text\/html;charset=UTF-8&quot; . &quot;\\r\\n&quot;;\/\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-735","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/comments?post=735"}],"version-history":[{"count":12,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/735\/revisions"}],"predecessor-version":[{"id":749,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/posts\/735\/revisions\/749"}],"wp:attachment":[{"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/media?parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/categories?post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.searchenginegenie.com\/programming-blog\/wp-json\/wp\/v2\/tags?post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}