smtp.module fails to work when recipients are specified using bcc, due to smtp not calling the necessary phpmailer AddBCC() function, but simply bundling BCC recipients into a header, which is insufficient when a messages is sent directly via smtp.

This breaks other modules (specifically mass_contact) when smtp is in use.

The attached patch fixes this. It would be good if this could be incorporated.

Thanks
Matthew

Comments

matthewc-1’s picture

StatusFileSize
new3.62 KB

Two more major problems with this module:

1. Multiple "to" addresses can be passed to drupal_mail_wrapper() in $to, however smtp lumps them all together and passes on to phpmailer's AddAddress() which is only designed to receive one recipient at a time - therefore sending to multiple recipients fails.

2. Content-Type headers are duplicated if already added in the $body passed to drupal_mail_wrapper(). This leads to malformed messages, e.g. when an attachment is sent by mass_contact module.

I've added my fixes for these two issues to the attached patch, along with the fix for the bcc issue.

Edit: patch updated to take into account recipients where just the address is given and no name, i.e. "user@example.com" rather than "user@example.com <Example User>"

Thanks
Matthew

oadaeh’s picture

The fix for the headers problem has been committed here: http://drupal.org/cvs?commit=90617

oadaeh’s picture

The fix for the multiple recipients problem has been committed here: http://drupal.org/cvs?commit=90656

oadaeh’s picture

The fix for BCC recipients problem has been committed here: http://drupal.org/cvs?commit=90657

oadaeh’s picture

Status: Needs review » Fixed

The code for passing through a pre-formated body has been committed here: http://drupal.org/cvs?commit=90662

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.