{"id":1818,"date":"2014-12-18T07:23:53","date_gmt":"2014-12-18T07:23:53","guid":{"rendered":"http:\/\/www.vishmax.com\/en\/?p=1818"},"modified":"2014-12-18T07:24:21","modified_gmt":"2014-12-18T07:24:21","slug":"how-to-send-html-email-with-php-solved","status":"publish","type":"post","link":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/","title":{"rendered":"How to send html email with PHP &#8211; solved"},"content":{"rendered":"<p>If you are a developer and using PHP for development then in some projects you need to create email functions according to client requirement. You can send simple emails by using default mail function of PHP. Here is a piece of code which allows you to send HTML mail with proper usage of extra headers. This will give more flexibility so you can attach files format it in HTML and many more.<\/p>\n<pre lang=\"php\">\r\n\r\n<?php \r\n\r\n\t$to   = \"user@userdomain.com\";\r\n\t$from = 'admin@vishmax.com';\r\n\t\r\n\t$headers = \"From: \" . strip_tags($from) . \"\\r\\n\";\r\n\t$headers .= \"Reply-To: \". strip_tags($from) . \"\\r\\n\";\r\n\t$headers .= \"CC: admin@vishmax.com\\r\\n\";\r\n\t$headers .= \"MIME-Version: 1.0\\r\\n\";\r\n\t$headers .= \"Content-Type: text\/html; charset=ISO-8859-1\\r\\n\";\r\n\t\r\n\t$message = '<html><body>';\r\n\t$message .= '<table width=\"100%\"; rules=\"all\" style=\"border:1px solid #3A5896;\" cellpadding=\"10\">';\r\n\t$message .= \"<tr><td colspan=2>Hello \\$Name,<br \/><br \/>Expand the message part according to your design layout<\/td><\/tr>\";\r\n\t$message .= \"<\/table>\";\r\n\t$message .= \"<\/body><\/html>\";\r\n\t\r\n\tmail($to, $subject, $message, $headers);\r\n\r\n?>\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you are a developer and using PHP for development then in some projects you need to create email functions according to client requirement. You can send simple emails by using default mail function of PHP. Here is a piece of code which allows you to send HTML mail with proper usage of extra headers. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44],"tags":[72,48],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to send html email with PHP - solved - Vishmax.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to send html email with PHP - solved - Vishmax.com\" \/>\n<meta property=\"og:description\" content=\"If you are a developer and using PHP for development then in some projects you need to create email functions according to client requirement. You can send simple emails by using default mail function of PHP. Here is a piece of code which allows you to send HTML mail with proper usage of extra headers. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\" \/>\n<meta property=\"og:site_name\" content=\"Vishmax.com\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-18T07:23:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-12-18T07:24:21+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\"},\"headline\":\"How to send html email with PHP &#8211; solved\",\"datePublished\":\"2014-12-18T07:23:53+00:00\",\"dateModified\":\"2014-12-18T07:24:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\"},\"wordCount\":81,\"publisher\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#organization\"},\"keywords\":[\"Code Library\",\"PHP\"],\"articleSection\":[\"Labs\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\",\"name\":\"How to send html email with PHP - solved - Vishmax.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#website\"},\"datePublished\":\"2014-12-18T07:23:53+00:00\",\"dateModified\":\"2014-12-18T07:24:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vishmax.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to send html email with PHP &#8211; solved\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#website\",\"url\":\"https:\/\/www.vishmax.com\/en\/\",\"name\":\"Vishmax.com\",\"description\":\"Software Company in Calicut for Web Design and eCommerce\",\"publisher\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vishmax.com\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#organization\",\"name\":\"Vishmax.com\",\"url\":\"https:\/\/www.vishmax.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"contentUrl\":\"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png\",\"width\":150,\"height\":50,\"caption\":\"Vishmax.com\"},\"image\":{\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.vishmax.com\/en\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to send html email with PHP - solved - Vishmax.com","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/","og_locale":"en_US","og_type":"article","og_title":"How to send html email with PHP - solved - Vishmax.com","og_description":"If you are a developer and using PHP for development then in some projects you need to create email functions according to client requirement. You can send simple emails by using default mail function of PHP. Here is a piece of code which allows you to send HTML mail with proper usage of extra headers. [&hellip;]","og_url":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/","og_site_name":"Vishmax.com","article_published_time":"2014-12-18T07:23:53+00:00","article_modified_time":"2014-12-18T07:24:21+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/#article","isPartOf":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/"},"author":{"name":"admin","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93"},"headline":"How to send html email with PHP &#8211; solved","datePublished":"2014-12-18T07:23:53+00:00","dateModified":"2014-12-18T07:24:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/"},"wordCount":81,"publisher":{"@id":"https:\/\/www.vishmax.com\/en\/#organization"},"keywords":["Code Library","PHP"],"articleSection":["Labs"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/","url":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/","name":"How to send html email with PHP - solved - Vishmax.com","isPartOf":{"@id":"https:\/\/www.vishmax.com\/en\/#website"},"datePublished":"2014-12-18T07:23:53+00:00","dateModified":"2014-12-18T07:24:21+00:00","breadcrumb":{"@id":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vishmax.com\/en\/labs\/how-to-send-html-email-with-php-solved\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vishmax.com\/en\/"},{"@type":"ListItem","position":2,"name":"How to send html email with PHP &#8211; solved"}]},{"@type":"WebSite","@id":"https:\/\/www.vishmax.com\/en\/#website","url":"https:\/\/www.vishmax.com\/en\/","name":"Vishmax.com","description":"Software Company in Calicut for Web Design and eCommerce","publisher":{"@id":"https:\/\/www.vishmax.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vishmax.com\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vishmax.com\/en\/#organization","name":"Vishmax.com","url":"https:\/\/www.vishmax.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","contentUrl":"https:\/\/www.vishmax.com\/en\/wp-content\/uploads\/2023\/03\/logo-vishmax.png","width":150,"height":50,"caption":"Vishmax.com"},"image":{"@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/785fa94b56eb17ae7706d30777d6ab93","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vishmax.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e218268870406c917d20b442936d9e68?s=96&d=monsterid&r=g","caption":"admin"},"url":"https:\/\/www.vishmax.com\/en\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/1818"}],"collection":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/comments?post=1818"}],"version-history":[{"count":0,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/posts\/1818\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/media?parent=1818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/categories?post=1818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vishmax.com\/en\/wp-json\/wp\/v2\/tags?post=1818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}