{"id":1803,"date":"2022-05-17T17:15:43","date_gmt":"2022-05-17T17:15:43","guid":{"rendered":"https:\/\/shaplakanon.com\/wpsupport\/?p=1803"},"modified":"2022-05-17T17:15:45","modified_gmt":"2022-05-17T17:15:45","slug":"how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin","status":"publish","type":"post","link":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/","title":{"rendered":"How to use smtp to send email in wordpress without smtp plugin?"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The\u00a0<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_mail\/\">wp_mail()<\/a>\u00a0function relies on the\u00a0<a href=\"https:\/\/github.com\/PHPMailer\/PHPMailer\/\">PHPMailer<\/a>\u00a0class to send email through PHP\u2019s\u00a0<code>mail<\/code>\u00a0function. The\u00a0<code>phpmailer_init<\/code>\u00a0action hook in <a href=\"https:\/\/www.reddit.com\/user\/abuduzana\/comments\/fhwmgp\/3_best_wordpress_hosting_in_2020_recommendation\/\" target=\"_blank\" rel=\"noreferrer noopener\">wordpress<\/a> allows you to hook to the phpmailer object and pass in your own arguments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This action is initiated with `do_action_ref_array` rather than `do_action`. You still hook to it with `do_action`. However, there are some notable differences:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>If you pass an array to `<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/do_action_ref_array\/\">do_action_ref_array()<\/a>`, each element\u2019s value of that array is passed as a separate parameter to the callback.<\/li><li>If you pass an array to `<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/do_action\/\">do_action()<\/a>`, the complete array is passed as a single argument including any keys.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">This is an example of establishing an SMTP connection using the `<code>phpmailer_init<\/code>` action:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function my_phpmailer_example( $phpmailer ) {\r\n    $phpmailer->isSMTP();     \r\n    $phpmailer->Host = 'smtp.example.com';\r\n    $phpmailer->SMTPAuth = true; \/\/ Ask it to use authenticate using the Username and Password properties\r\n    $phpmailer->Port = 25;\r\n    $phpmailer->Username = 'yourusername';\r\n    $phpmailer->Password = 'yourpassword';\r\n \r\n    \/\/ Additional settings\u2026\r\n    \/\/$phpmailer->SMTPSecure = 'tls'; \/\/ Choose 'ssl' for SMTPS on port 465, or 'tls' for SMTP+STARTTLS on port 25 or 587\r\n    \/\/$phpmailer->From = \"you@yourdomail.com\";\r\n    \/\/$phpmailer->FromName = \"Your Name\";\r\n}\r\nadd_action( 'phpmailer_init', 'my_phpmailer_example' );<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Get Support:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If you need any help with this action hook, feel free to comment below. If you are interested in our paid service , check out our\u00a0<a href=\"https:\/\/techvila.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">wordpress maintenance service<\/a>\u00a0website and talk to real people..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The\u00a0wp_mail()\u00a0function relies on the\u00a0PHPMailer\u00a0class to send email through PHP\u2019s\u00a0mail\u00a0function. The\u00a0phpmailer_init\u00a0action hook in wordpress allows you to hook to the phpmailer<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[296,51],"tags":[],"class_list":["post-1803","post","type-post","status-publish","format-standard","hentry","category-tutorial","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to use smtp to send email in wordpress without smtp plugin? - WordPress Support<\/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:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use smtp to send email in wordpress without smtp plugin? - WordPress Support\" \/>\n<meta property=\"og:description\" content=\"The\u00a0wp_mail()\u00a0function relies on the\u00a0PHPMailer\u00a0class to send email through PHP\u2019s\u00a0mail\u00a0function. The\u00a0phpmailer_init\u00a0action hook in wordpress allows you to hook to the phpmailer\" \/>\n<meta property=\"og:url\" content=\"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/\" \/>\n<meta property=\"og:site_name\" content=\"WordPress Support\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/getwpsupport\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-17T17:15:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-17T17:15:45+00:00\" \/>\n<meta name=\"author\" content=\"ShaplaKanon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ruhul24\" \/>\n<meta name=\"twitter:site\" content=\"@ruhul24\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ShaplaKanon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/\"},\"author\":{\"name\":\"ShaplaKanon\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#\\\/schema\\\/person\\\/f5f224239283c27426dadc2e4cc9a825\"},\"headline\":\"How to use smtp to send email in wordpress without smtp plugin?\",\"datePublished\":\"2022-05-17T17:15:43+00:00\",\"dateModified\":\"2022-05-17T17:15:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/\"},\"wordCount\":168,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#organization\"},\"articleSection\":[\"Tutorial\",\"wordpress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/\",\"url\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/\",\"name\":\"How to use smtp to send email in wordpress without smtp plugin? - WordPress Support\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#website\"},\"datePublished\":\"2022-05-17T17:15:43+00:00\",\"dateModified\":\"2022-05-17T17:15:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use smtp to send email in wordpress without smtp plugin?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#website\",\"url\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/\",\"name\":\"WordPress Support\",\"description\":\"Wordpress Repair, migration, speed optimization\",\"publisher\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#organization\",\"name\":\"WordPress Support\",\"url\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/05\\\/cropped-logo-9674824.png\",\"contentUrl\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/05\\\/cropped-logo-9674824.png\",\"width\":274,\"height\":55,\"caption\":\"WordPress Support\"},\"image\":{\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/facebook.com\\\/getwpsupport\\\/\",\"https:\\\/\\\/x.com\\\/ruhul24\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/#\\\/schema\\\/person\\\/f5f224239283c27426dadc2e4cc9a825\",\"name\":\"ShaplaKanon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ef2c8f93a0558c2047555f674c8746b22988ace93eba9262d198d0a28236ce97?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ef2c8f93a0558c2047555f674c8746b22988ace93eba9262d198d0a28236ce97?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ef2c8f93a0558c2047555f674c8746b22988ace93eba9262d198d0a28236ce97?s=96&d=mm&r=g\",\"caption\":\"ShaplaKanon\"},\"sameAs\":[\"https:\\\/\\\/shaplakanon.com\\\/wdc\\\/\"],\"url\":\"https:\\\/\\\/shaplakanon.com\\\/wpsupport\\\/author\\\/sabahat\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use smtp to send email in wordpress without smtp plugin? - WordPress Support","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:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/","og_locale":"en_US","og_type":"article","og_title":"How to use smtp to send email in wordpress without smtp plugin? - WordPress Support","og_description":"The\u00a0wp_mail()\u00a0function relies on the\u00a0PHPMailer\u00a0class to send email through PHP\u2019s\u00a0mail\u00a0function. The\u00a0phpmailer_init\u00a0action hook in wordpress allows you to hook to the phpmailer","og_url":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/","og_site_name":"WordPress Support","article_publisher":"https:\/\/facebook.com\/getwpsupport\/","article_published_time":"2022-05-17T17:15:43+00:00","article_modified_time":"2022-05-17T17:15:45+00:00","author":"ShaplaKanon","twitter_card":"summary_large_image","twitter_creator":"@ruhul24","twitter_site":"@ruhul24","twitter_misc":{"Written by":"ShaplaKanon","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/#article","isPartOf":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/"},"author":{"name":"ShaplaKanon","@id":"https:\/\/shaplakanon.com\/wpsupport\/#\/schema\/person\/f5f224239283c27426dadc2e4cc9a825"},"headline":"How to use smtp to send email in wordpress without smtp plugin?","datePublished":"2022-05-17T17:15:43+00:00","dateModified":"2022-05-17T17:15:45+00:00","mainEntityOfPage":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/"},"wordCount":168,"commentCount":0,"publisher":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/#organization"},"articleSection":["Tutorial","wordpress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/","url":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/","name":"How to use smtp to send email in wordpress without smtp plugin? - WordPress Support","isPartOf":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/#website"},"datePublished":"2022-05-17T17:15:43+00:00","dateModified":"2022-05-17T17:15:45+00:00","breadcrumb":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/shaplakanon.com\/wpsupport\/how-to-use-smtp-to-send-email-in-wordpress-without-smtp-plugin\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/shaplakanon.com\/wpsupport\/"},{"@type":"ListItem","position":2,"name":"How to use smtp to send email in wordpress without smtp plugin?"}]},{"@type":"WebSite","@id":"https:\/\/shaplakanon.com\/wpsupport\/#website","url":"https:\/\/shaplakanon.com\/wpsupport\/","name":"WordPress Support","description":"Wordpress Repair, migration, speed optimization","publisher":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/shaplakanon.com\/wpsupport\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/shaplakanon.com\/wpsupport\/#organization","name":"WordPress Support","url":"https:\/\/shaplakanon.com\/wpsupport\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/shaplakanon.com\/wpsupport\/#\/schema\/logo\/image\/","url":"https:\/\/shaplakanon.com\/wpsupport\/wp-content\/uploads\/sites\/2\/2022\/05\/cropped-logo-9674824.png","contentUrl":"https:\/\/shaplakanon.com\/wpsupport\/wp-content\/uploads\/sites\/2\/2022\/05\/cropped-logo-9674824.png","width":274,"height":55,"caption":"WordPress Support"},"image":{"@id":"https:\/\/shaplakanon.com\/wpsupport\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/facebook.com\/getwpsupport\/","https:\/\/x.com\/ruhul24"]},{"@type":"Person","@id":"https:\/\/shaplakanon.com\/wpsupport\/#\/schema\/person\/f5f224239283c27426dadc2e4cc9a825","name":"ShaplaKanon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef2c8f93a0558c2047555f674c8746b22988ace93eba9262d198d0a28236ce97?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef2c8f93a0558c2047555f674c8746b22988ace93eba9262d198d0a28236ce97?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef2c8f93a0558c2047555f674c8746b22988ace93eba9262d198d0a28236ce97?s=96&d=mm&r=g","caption":"ShaplaKanon"},"sameAs":["https:\/\/shaplakanon.com\/wdc\/"],"url":"https:\/\/shaplakanon.com\/wpsupport\/author\/sabahat\/"}]}},"_links":{"self":[{"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/posts\/1803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/comments?post=1803"}],"version-history":[{"count":2,"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/posts\/1803\/revisions"}],"predecessor-version":[{"id":1805,"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/posts\/1803\/revisions\/1805"}],"wp:attachment":[{"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/media?parent=1803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/categories?post=1803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shaplakanon.com\/wpsupport\/wp-json\/wp\/v2\/tags?post=1803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}