Add cc and bcc using c5 mail helper

Is it possible to have CC/BCC and/or other headers using the Concrete5 mail helper, or is it limited to just using the To address?

View Replies:
RadiantWeb replied on at Permalink Reply
Hey J,

did you ever figure this out? I just had a need to implement bcc. wondering what you ended up doing on this.

jgarcia replied on at Permalink Reply
Yeah I did, and if I recall correctly, it was pretty easy. I'll have to dig up the files though...I'll post a solution for you sometime today.
Shotster replied on at Permalink Reply
Hi Chad,

I've done this as well. Turns out C5 uses the Zend_Mail class which has an addBcc() method. However, the C5 mail helper does not implement a Bcc method, so I simply extended the C5 mail helper class as follows...

class SiteMailHelper extends MailHelper {
   protected $bcc = array();
   public function bcc($email) {
      if (strpos($email, ',') > 0) {
         $email = explode(',', $email);
         foreach($email as $em) {
            $this->bcc[] = trim( $em );
      } else {
         $this->bcc[] = trim( $email );   
    * Sends the email

(You could of course add a regular Cc method as well if you need that.)

I'm assuming you know how to extend a helper, but for those following this thread who don't, proceed as follows...

1) Create a file called mail.php in the root /helpers directory.

2) Define a class called "SiteMailHelper" (as shown in the code above) and implement that class.

It's important to note that this doesn't simply override the built-in /concrete/helpers/mail.php file, but rather EXTENDS the "MailHelper" class. Note that you must prefix the original class name with "Site".

(EDIT: It would probably be good just to add Cc and Bcc functionality to the built-in mail helper and submit the change via GitHub.)

Ale replied on at Permalink Reply
Thanks Shotster for posting a solution. I did exactly as you described and Concrete does use the extended class and modified sendmail function. However, when the mail is sent, all recipients are visible in mail headers and email clients show all the repients, even if they were bcc's.

I tried to trace what's going on and the addBcc() seems to work and even var_dumping the whole mail-object shows that the repients are in their respective "categories" (to and bcc). However, after the sendmail() the end result is what I described above...

Any ideas what's going on?
Shotster replied on at Permalink Reply
I wonder if it could be a server config issue or something. I would suggest stepping through the entire process with a debugger to try to learn where it's tripping up.

Sorry, I wish I could be of more help.