{"id":2579,"date":"2017-06-28T15:49:46","date_gmt":"2017-06-28T15:49:46","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=2579"},"modified":"2017-06-28T15:52:49","modified_gmt":"2017-06-28T15:52:49","slug":"send-email-via-smtp-server-wordpress","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/","title":{"rendered":"Send Email via SMTP Server in WordPress"},"content":{"rendered":"<p>When sending email from the script, it always a good idea to send using SMTP server. <a href=\"https:\/\/www.codexworld.com\/send-html-email-php-gmail-smtp-phpmailer\/\">Send email via SMTP server<\/a> prevents many issues such as your email being marked as spam. Basically, the <code>mail()<\/code> or <code>wp_mail()<\/code> function is used to send email in WordPress. If you want to use SMTP server to <b>send email in WordPress<\/b>, PHPMailer Class will be the best choice.<\/p>\n<p>There are many plugins are available in WordPress to sending the email via SMTP server. But you can easily send emails using SMTP server in WordPress without using any plugins. In this tutorial, we will show you how to <b>send email using SMTP in WordPress<\/b>. With SMTP configuration you can increase the email deliverability in your WordPress site.<\/p>\n<h2>WordPress PHPMailer Class<\/h2>\n<p>Before you get started, the PHPMailer class need to be initialized.<\/p>\n<pre><span style=\"color: #FF8000\">\/*<br \/>&nbsp;*&nbsp;Initialize&nbsp;phpmailer&nbsp;class<br \/>&nbsp;*\/<br \/><\/span><span style=\"color: #007700\">global&nbsp;<\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;(Re)create&nbsp;it,&nbsp;if&nbsp;it's&nbsp;gone&nbsp;missing<br \/><\/span><span style=\"color: #007700\">if&nbsp;(&nbsp;!&nbsp;(&nbsp;<\/span><span style=\"color: #0000BB\">$phpmailer&nbsp;<\/span><span style=\"color: #007700\">instanceof&nbsp;<\/span><span style=\"color: #0000BB\">PHPMailer&nbsp;<\/span><span style=\"color: #007700\">)&nbsp;)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;require_once&nbsp;<\/span><span style=\"color: #0000BB\">ABSPATH&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">WPINC&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #DD0000\">'\/class-phpmailer.php'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;require_once&nbsp;<\/span><span style=\"color: #0000BB\">ABSPATH&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">WPINC&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #DD0000\">'\/class-smtp.php'<\/span><span style=\"color: #007700\">;<br \/>}<br \/><\/span><span style=\"color: #0000BB\">$phpmailer&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">PHPMailer<\/span><span style=\"color: #007700\">;<\/span><\/pre>\n<h2>Send HTML Email in WordPress via SMTP<\/h2>\n<p>The following example code sends HTML email via SMTP with PHPMailer class in WordPress.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;SMTP&nbsp;configuration<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">isSMTP<\/span><span style=\"color: #007700\">();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Host&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'smtp.example.com'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">SMTPAuth&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Username&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'user@example.com'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Password&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'*****'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">SMTPSecure&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'tls'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Port&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">587<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">setFrom<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'info@example.com'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'CodexWorld'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Add&nbsp;a&nbsp;recipient<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addAddress<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'john@example.com'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Add&nbsp;cc&nbsp;or&nbsp;bcc&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addCC<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'cc@example.com'<\/span><span style=\"color: #007700\">);<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addBCC<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'bcc@example.com'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Set&nbsp;email&nbsp;format&nbsp;to&nbsp;HTML<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">isHTML<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Email&nbsp;subject<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Subject&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'Send&nbsp;Email&nbsp;via&nbsp;SMTP&nbsp;from&nbsp;WordPress'<\/span><span style=\"color: #007700\">;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;Email&nbsp;body&nbsp;content<br \/><\/span><span style=\"color: #0000BB\">$mailContent&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"&lt;h1&gt;Send&nbsp;HTML&nbsp;Email&nbsp;using&nbsp;SMTP&nbsp;in&nbsp;WordPress&lt;\/h1&gt;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;This&nbsp;is&nbsp;a&nbsp;test&nbsp;email&nbsp;has&nbsp;sent&nbsp;using&nbsp;SMTP&nbsp;mail&nbsp;server&nbsp;with&nbsp;PHPMailer&nbsp;from&nbsp;WOrdPress.&lt;\/p&gt;\"<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Body&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$mailContent<\/span><span style=\"color: #007700\">;<br \/><br \/>if(!<\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">send<\/span><span style=\"color: #007700\">()){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Message&nbsp;could&nbsp;not&nbsp;be&nbsp;sent.'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Mailer&nbsp;Error:&nbsp;'&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">ErrorInfo<\/span><span style=\"color: #007700\">;<br \/>}else{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Message&nbsp;has&nbsp;been&nbsp;sent'<\/span><span style=\"color: #007700\">;<br \/>}<\/span><\/pre>\n<h2>Send Email to Multiple Recipients<\/h2>\n<p>Add <code>addAddress()<\/code> method multiple times to send an email to multiple recipients.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Add&nbsp;multiple&nbsp;recipient<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addAddress<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'john@example.com'<\/span><span style=\"color: #007700\">);<\/span><br \/><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addAddress<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'marry@example.com'<\/span><span style=\"color: #007700\">);<\/span><br \/><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">addAddress<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'smith@example.com'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<h2>Send Email using Gmail SMTP in WordPress<\/h2>\n<p>If you wish to use your Gmail account to send email from WordPress, you need to make some changes in Google account settings. Configure your Google account by the following changes to use <b>Gmail SMTP in WordPress<\/b>.<\/p>\n<ul class=\"bullet_disk_list\">\n<li>Login to your Google account.<\/li>\n<li>Go to the <a href=\"https:\/\/myaccount.google.com\" target=\"_blank\">My Account<\/a> page. Click the <b>Signing in to Google<\/b> link from <b>Sign-in &#038; security<\/b> section.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-account-settings-codexworld.png\" alt=\"send-email-php-gmail-smtp-account-settings-codexworld\" width=\"824\" height=\"478\" class=\"alignnone size-full wp-image-2321\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-account-settings-codexworld.png 824w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-account-settings-codexworld-300x174.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-account-settings-codexworld-768x446.png 768w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-account-settings-codexworld-200x116.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-account-settings-codexworld-346x201.png 346w\" sizes=\"auto, (max-width: 824px) 100vw, 824px\" \/><\/div>\n<\/li>\n<li>Scroll down the <b>Password &#038; sign-in method<\/b> section and turn Off the <b>2-Step Verification<\/b>.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-off-2-step-verification-codexworld.png\" alt=\"send-email-php-gmail-smtp-off-2-step-verification-codexworld\" width=\"630\" height=\"386\" class=\"alignnone size-full wp-image-2322\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-off-2-step-verification-codexworld.png 630w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-off-2-step-verification-codexworld-300x184.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-off-2-step-verification-codexworld-200x123.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-off-2-step-verification-codexworld-346x212.png 346w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/div>\n<\/li>\n<li>Scroll down the <b>Connected apps &#038; sites<\/b> section and turn On <b>Allow less secure apps<\/b>.\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-allow-less-secure-apps-codexworld.png\" alt=\"send-email-php-gmail-smtp-allow-less-secure-apps-codexworld\" width=\"644\" height=\"229\" class=\"alignnone size-full wp-image-2323\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-allow-less-secure-apps-codexworld.png 644w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-allow-less-secure-apps-codexworld-300x107.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-allow-less-secure-apps-codexworld-200x71.png 200w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/04\/send-email-php-gmail-smtp-allow-less-secure-apps-codexworld-346x123.png 346w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/div>\n<\/li>\n<\/ul>\n<p>You are done! Now you can use your <b>Gmail account as an SMTP server<\/b> to send email from WordPress.<\/p>\n<p>Specify your Gmail account credentials (email address and password), SMTP host and port.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;Gmail&nbsp;SMTP&nbsp;configuration<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">isSMTP<\/span><span style=\"color: #007700\">();<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Host&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'smtp.gmail.com'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">SMTPAuth&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Username&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'codexworld@gmail.com'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Password&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'********'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">SMTPSecure&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'tls'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$phpmailer<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">Port&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">587<\/span><span style=\"color: #007700\">;<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When sending email from the script, it always a good idea to send using SMTP server. Send email via SMTP server prevents many issues such as your email being marked as spam. Basically, the mail() <\/p>\n","protected":false},"author":1,"featured_media":2580,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[23,24,147,276,25],"class_list":["post-2579","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-email","tag-html-email","tag-phpmailer","tag-smtp","tag-wordpress","cat-5-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Send Email via SMTP Server in WordPress - CodexWorld<\/title>\n<meta name=\"description\" content=\"WordPress SMTP Mail - Send email from WordPress using SMTP server without any plugin. Example script to send email via Gmail SMTP in WordPress.\" \/>\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.codexworld.com\/send-email-via-smtp-server-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Send Email via SMTP Server in WordPress - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"WordPress SMTP Mail - Send email from WordPress using SMTP server without any plugin. Example script to send email via Gmail SMTP in WordPress.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-28T15:49:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-06-28T15:52:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"Send Email via SMTP Server in WordPress\",\"datePublished\":\"2017-06-28T15:49:46+00:00\",\"dateModified\":\"2017-06-28T15:52:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/\"},\"wordCount\":303,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/send-email-via-gmail-smtp-wordpress-codexworld.png\",\"keywords\":[\"Email\",\"HTML Email\",\"PHPMailer\",\"SMTP\",\"WordPress\"],\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/\",\"name\":\"Send Email via SMTP Server in WordPress - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/send-email-via-gmail-smtp-wordpress-codexworld.png\",\"datePublished\":\"2017-06-28T15:49:46+00:00\",\"dateModified\":\"2017-06-28T15:52:49+00:00\",\"description\":\"WordPress SMTP Mail - Send email from WordPress using SMTP server without any plugin. Example script to send email via Gmail SMTP in WordPress.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/send-email-via-gmail-smtp-wordpress-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2017\\\/06\\\/send-email-via-gmail-smtp-wordpress-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"send-email-via-gmail-smtp-wordpress-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/send-email-via-smtp-server-wordpress\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Send Email via SMTP Server in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Send Email via SMTP Server in WordPress - CodexWorld","description":"WordPress SMTP Mail - Send email from WordPress using SMTP server without any plugin. Example script to send email via Gmail SMTP in WordPress.","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.codexworld.com\/send-email-via-smtp-server-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"Send Email via SMTP Server in WordPress - CodexWorld","og_description":"WordPress SMTP Mail - Send email from WordPress using SMTP server without any plugin. Example script to send email via Gmail SMTP in WordPress.","og_url":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2017-06-28T15:49:46+00:00","article_modified_time":"2017-06-28T15:52:49+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"Send Email via SMTP Server in WordPress","datePublished":"2017-06-28T15:49:46+00:00","dateModified":"2017-06-28T15:52:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/"},"wordCount":303,"commentCount":0,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png","keywords":["Email","HTML Email","PHPMailer","SMTP","WordPress"],"articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/","url":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/","name":"Send Email via SMTP Server in WordPress - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png","datePublished":"2017-06-28T15:49:46+00:00","dateModified":"2017-06-28T15:52:49+00:00","description":"WordPress SMTP Mail - Send email from WordPress using SMTP server without any plugin. Example script to send email via Gmail SMTP in WordPress.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png","width":1366,"height":768,"caption":"send-email-via-gmail-smtp-wordpress-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/send-email-via-smtp-server-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"Send Email via SMTP Server in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2017\/06\/send-email-via-gmail-smtp-wordpress-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-FB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2579","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=2579"}],"version-history":[{"count":5,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2579\/revisions"}],"predecessor-version":[{"id":2584,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/2579\/revisions\/2584"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/2580"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=2579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=2579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=2579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}