Solved

PHP mail() - add a BCC recipient

Posted on 2009-04-07
4
410 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
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.

914 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now