Solved

PHP mail() - add a BCC recipient

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

707 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

14 Experts available now in Live!

Get 1:1 Help Now