Send PHP Mail with Reply-To Cc Bcc in PHPmailer or WordPress |
X

Congrats, You are Subscribed to Receive Updates.

Send PHP Mail with Reply-To Cc Bcc in PHPmailer or WordPress


Send PHP Mail with Reply-To Cc Bcc in PHPmailer or WordPress. With Help of composing PHP  to send a complete mail with CC, Reply-To, BCC. This article along with continues of my previous article  How to Create Contact Form with PHPMailer to send mails. You can create your contact emails with help of it. With this below code, you can send email to multiple copies like the features of CC(Carbon Copy), BCC(Blind Carbon Copy).

And Finally, the Reply-To feature as well.

$header = "From: no-reply@kvcodes.com \r\n";
if(isset($_POST['cc']) ) 
	$header .= "Cc: " . esc_attr($_POST['cc']) . "\r\n";
if(isset($_POST['bcc']) ) 
	$header .= "Bcc: " . esc_attr($_POST['bcc']) . "\r\n";
if(isset($_POST['replyto']) ) 
	$header .= "Reply-to: " . esc_attr($_POST['replyto']) . "\r\n";

That’s it.  Please drop comments on the next tab, if you have doubt or clarifications.
send-php-mail-with-reply-to-cc-bcc-in-phpmailer-or-wordpress

If you really enjoy my tutorial, you can follow me on social sites to get more articles and updates from me.

commenter

About Varadharaj V

The founder of Kvcodes, Varadharaj V is an ERP Analyst and a Web developer specializing in WordPress(WP), WP Theme development, WP Plugin development, Frontaccounting(FA), Sales, Purchases, Inventory, Ledgers, Payroll & HRM, CRM, FA Core Customization, PHP and Data Analyst. Database Management Advance Level

3 comments

  1. commenter

    Hi,
    You have posted code for frondend only, instead of i need backend multiple file uploads within plugin sub menu. So, please give me backend source code for further move…

  2. commenter

    Hello Varadharaj,

    I want to add a field for ‘BCC’, so I use, on the contact.php form:

    This is just a copy of the sender’s email field, basically.

    And I use the code:

    $header = “From: MY EMAIL ADDRESS \r\n”;
    if(isset($_POST[‘bcc’]) )
    $header .= “Bcc: ” . esc_attr($_POST[‘bcc’]) . “\r\n”;

    When I fill the form in along with a BCC email, nothing happens. The form still works but the recipient in BCC gets no mail!

    What am I doing wrong?

    Thank you.

    John

Comment Below

Your email address will not be published. Required fields are marked *

*

Current ye@r *

Menu

Sidebar