9951 explained code solutions for 126 technologies


php-swiftmailerHow to set multiple BCC addresses using Swiftmailer?


Swiftmailer can be used to set multiple BCC addresses in an email. To do this, the addBcc() method can be used. The following example code shows how to set multiple BCC addresses using Swiftmailer:

$message = (new \Swift_Message('Hello World'))
    ->setFrom('[email protected]')
    ->setTo('[email protected]')
    ->addBcc('[email protected]')
    ->addBcc('[email protected]');

The output of the above code will be an email sent from [email protected] to [email protected] with [email protected] and [email protected] as BCC recipients.

Code explanation

Helpful links

Edit this code on GitHub