Send PHP Mail with Reply-To Cc Bcc in PHPmailer or WordPress
- Article
- Comment (3)
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.
If you really enjoy my tutorial, you can follow me on social sites to get more articles and updates from me.
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…
I have no idea of our questions. Whats front end and backend with simple mail reply-to, cc, and bcc. you can use the same code everywhere,right ?
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