Solved

PHP mail() - add a BCC recipient

Posted on 2009-04-07
4
412 Views
Last Modified: 2012-08-13
How can I add a BCC recipient?
$to      = 'me@example.com';
$subject = 'Subject';
$message = mailClean(str_replace("\n","#nl#",$orderEmail));
$headers = 'From: My Name <me@example.com>' . "\r\n" .
    'Reply-To: me@example.com' . "\r\n" .
    'X-Mailer: WEBSITE ' . time();
    mail($to, $subject, $message, $headers);

Open in new window

0
Comment
Question by:hankknight
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
brittonv earned 400 total points
ID: 24086586
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

For referenece:http://us.php.net/function.mail
0
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 50 total points
ID: 24086612
Hello,

For example:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: ex@example.com>' . "\r\n";
$headers .= 'From: exa@example.com>' . "\r\n";
$headers .= 'Cc: exam@example.com' . "\r\n";
$headers .= 'Bcc: examp@example.com' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

Regards.
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24086622
0
 
LVL 36

Assisted Solution

by:Loganathan Natarajan
Loganathan Natarajan earned 50 total points
ID: 24087276
just modify your header like this,


$headers = 'From: My Name <me@example.com>' . "\r\n"  .
 'Cc: exam@example.com' . "\r\n' . 
 'Reply-To: me@example.com' . "\r\n" .
    'X-Mailer: WEBSITE ' . time();
    mail($to, $subject, $message, $headers);

Open in new window

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question