Skip to content
PHP Logo

How can PHP be used to send emails with BCC recipients?

To send emails with BCC recipients using PHP, you can simply add the BCC email addresses to the additional_headers parameter of the mail() function. This parameter allows you to specify additional headers, including BCC recipients, in the email.

php
$to = 'recipient@example.com';
$subject = 'Test Email with BCC';
$message = 'This is a test email with BCC recipients';
$headers = 'From: sender@example.com' . "\r\n";
$bcc = 'bcc1@example.com, bcc2@example.com';
$headers .= 'Bcc: ' . $bcc . "\r\n";

mail($to, $subject, $message, $headers);