{"id":239,"date":"2017-07-21T05:50:56","date_gmt":"2017-07-21T05:50:56","guid":{"rendered":"http:\/\/templatetoaster.com\/tutorials\/?p=239"},"modified":"2017-07-21T06:20:55","modified_gmt":"2017-07-21T06:20:55","slug":"how-to-cc-bcc-in-wordpress-mail","status":"publish","type":"post","link":"https:\/\/templatetoaster.com\/tutorials\/how-to-cc-bcc-in-wordpress-mail\/","title":{"rendered":"How to Add Multi-Recipients by Cc Bcc in WordPress Mail?"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-240\" src=\"https:\/\/templatetoaster.com\/tutorials\/wp-content\/uploads\/2017\/07\/How-to-Cc-Bcc-in-WordPress-Mail-Blog.jpg\" alt=\"Bcc in WordPress Mail\" width=\"825\" height=\"432\" srcset=\"https:\/\/templatetoaster.com\/tutorials\/wp-content\/uploads\/2017\/07\/How-to-Cc-Bcc-in-WordPress-Mail-Blog.jpg 825w, https:\/\/templatetoaster.com\/tutorials\/wp-content\/uploads\/2017\/07\/How-to-Cc-Bcc-in-WordPress-Mail-Blog-300x157.jpg 300w, https:\/\/templatetoaster.com\/tutorials\/wp-content\/uploads\/2017\/07\/How-to-Cc-Bcc-in-WordPress-Mail-Blog-768x402.jpg 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/p>\n<p>I was constantly getting the queries regarding how to add multiple recipients to a WordPress mail. So here I have tried to give a simple but elegant solution to Cc, Bcc in WordPress mail.<\/p>\n<p>Email is one of the instant tools for business communication. It can be sent to multiple people for collaboration. Messages move quickly and lots of information can be shared in the body of the email. An email provides you different fields to add the recipients with the distinct motives. For example To, Cc, Bcc.<\/p>\n<ul>\n<li><strong>To<\/strong> is for Intended Actionable Recipients.<\/li>\n<li><strong>Cc (Carbon Copy)<\/strong> is for people you want should know about the message without any direct involvement. Added only to keep informed. The receiver comes to know about all the persons who are receiving email through Cc.<\/li>\n<li><strong>Bcc (Blind Carbon Copy)<\/strong> is used when you want to send an email to others but without knowledge of other recipients.<\/li>\n<\/ul>\n<p>In the case of WordPress too, you need to send the same email to multiple recipients. All the available plugins to Cc, Bcc in WordPress mail are now obsolete. So, you can simply use the following code to add Cc, Bcc in WordPress mails. Simply paste this code in \u201cfunctions.php\u201d file of your theme and replace the example mail ids with your mail ids. Moreover, the code will work with all the standard themes and WordPress themes generated with TemplateToaster <a href=\"https:\/\/templatetoaster.com\" target=\"_blank\" rel=\"noopener noreferrer\">web design software<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<h2>For adding Cc &amp; Bcc<\/h2>\n<pre>add_filter('wp_mail','custom_mails', 10,1);\r\n\r\nfunction custom_mails($args)\r\n{\r\n$bcc_email = sanitize_email('example@abc.com)';\r\n$cc_email = sanitize_email('example1@abc.com');\r\n\r\n\r\nif (is_array($args['headers'])) {\r\n$args['headers'][] = 'Bcc: '.$bcc_email ;\r\n$args['headers'][] = 'cc: '.$cc_email;\r\n}\r\nelse {\r\n\r\n$args['headers'] .= 'Bcc: '.$bcc_email.\"\\r\\n\";\r\n$args['headers'] .= 'cc: '.$cc_email.\"\\r\\n\";\r\n}\r\n\r\n\r\nreturn $args;\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>For adding Cc Only<\/h2>\n<pre>add_filter('wp_mail','custom_mails', 10,1);\r\n\r\nfunction custom_mails($args)\r\n{\r\n\r\n$cc_email = sanitize_email('example1@abc.com');\r\n\r\n\r\nif (is_array($args['headers'])) \r\n{\r\n\r\n$args['headers'][] = 'cc: '.$cc_email;\r\n}\r\nelse \r\n{\r\n\r\n$args['headers'] .= 'cc: '.$cc_email.\"\\r\\n\";\r\n}\r\n\r\n\r\nreturn $args;\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>For adding Bcc Only<\/h2>\n<pre>add_filter('wp_mail','custom_mails', 10,1);\r\n\r\nfunction custom_mails($args)\r\n{\r\n$bcc_email = sanitize_email('example@abc.com)';\r\n\r\nif (is_array($args['headers'])) \r\n{\r\n$args['headers'][] = 'Bcc: '.$bcc_email ;\r\n}\r\nelse \r\n{\r\n$args['headers'] .= 'Bcc: '.$bcc_email.\"\\r\\n\";\r\n}\r\n\r\nreturn $args;\r\n}\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Now, you have a simple and small easy script that will work out well in WordPress. Also, I am planning to write an article to create a plugin for Cc, Bcc in WordPress mail soon. Your feedback is always valuable. So please share your views.<\/p>\n<p>So this was all about how to add Cc, Bcc in WordPress mail but if you are still looking to setup your own SMTP for WordPress, <a href=\"https:\/\/templatetoaster.com\/tutorials\/wordpress-smtp-configure-send-emails\/\" target=\"_blank\" rel=\"noopener noreferrer\">check out this article.<\/a> Moreover, if you are all done with Mail configuration and thinking to give your site a makeover, start designing with TemplateToaster <a href=\"https:\/\/templatetoaster.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">web design software<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was constantly getting the queries regarding how to add multiple recipients to a WordPress mail. So here I have tried to give a simple but elegant solution to Cc, Bcc in WordPress mail.<\/p>\n<p><a href=\"https:\/\/templatetoaster.com\/tutorials\/how-to-cc-bcc-in-wordpress-mail\/\"><span class=\"btn btn-default\">Continue Reading<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/posts\/239"}],"collection":[{"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/comments?post=239"}],"version-history":[{"count":7,"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/posts\/239\/revisions"}],"predecessor-version":[{"id":252,"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/posts\/239\/revisions\/252"}],"wp:attachment":[{"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/media?parent=239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/categories?post=239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/templatetoaster.com\/tutorials\/wp-json\/wp\/v2\/tags?post=239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}