Adding headers to email templates

4 posts by 3 authors in: Forums > CMS Builder
Last Post: October 30, 2013   (RSS)

By ross - October 17, 2013

Hi Paul

Thanks for posting!

I see what you are aiming for and I think we can look at the code to make headers available.  What is it that triggers the emails being sent? It is a simple contact form on your site somewhere? What I am thinking of as an alternative would be to just setup a second sendMessage() call right after the first one. That way, you can send the second copy to another address.

Do you think that would work?

Let me know what you think. Thanks!

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By pault - October 21, 2013

Hi Ross,

Thanks for your reply.  I'm using the function to send message for various actions througout the site, for example when a user updates their profile.

I have done it at the moment using a second call to sendMessage but the reason I wanted to add additional headers was to add the Bcc to copy the site administrator so that not only can they see that an action has taken place but also who it was sent to and ay what time, etc.  If I use the second sendMessage() call as I am now, it's just sent To: the site administrator so they don't see who the original message was sent to.  Not a big deal, just a nice to have.

I noticed in the emailTemplate_loadFromDB function, which I'm using to populate the headers for sending, prior to calling sendMessage, there's the following code:

foreach ($passThruFields as $field) {
    if (!array_key_exists($field, $options)) { continue; }
    $emailHeaders[$field] = $options[$field];
}

Can this be used in someway to add the Bcc header?

Thanks, Paul.

By Dave - October 30, 2013

Hi Paul,

I think you're close.  Can you try replacing 'Bcc' with 'BCC' in your original code.  I think it's might be a case-sensitivity issue.

Let me know if that works, thanks!

Dave Edis - Senior Developer
interactivetools.com