bcc support in mass_contact is currently broken when smtp is in use due to a bug in the smtp module:

http://drupal.org/node/188624

However, mass_contact also treats messages differently when the smtp module is in use. This is incorrect. mass_contact should treat smtp messages the same as messages sent normally via mail(), and let smtp deal with it. When the patch I just posted in that other bug report has been applied to smtp, the conditional check for smtp use in mass_contact should be removed, as per the patch attached to this report.

Thanks for the great module :)
Matthew

CommentFileSizeAuthor
mass_contact.module-smtp.patch1.62 KBmatthewc-1

Comments

oadaeh’s picture

Assigned: Unassigned » oadaeh

I agree. I was simply trying to give users of both modules a working solution, as I don't actually expect anyone to do anything about the SMTP Auth module's bugs.

I know that BCC support is broken in the SMTP Auth module, but I couldn't really pin it down, since it seemed to be working for me. I did notice that the module wasn't calling the specific function, but I wasn't sure where it should be calling it, and I haven't really had the time to figure it out. The SMTP Auth module is also broken with regard to sending to multiple addresses, which is what my code deals with (by sending to each recipient, one at a time).

If there is a workable patch for the SMTP module I can point people to, however, I will change the behavior of the Mass Contact module. Your patch deals with the BCC issue, but not the multiple senders issue, though I believe I see how I can incorporate some of your code to deal with that issue also. I'll look into your SMTP Auth patch and test it with the Mass Contact module w/o its special case code in the next few days (now that my recent work has seen the light of day, I should have a little more time).

Thank you for your help in solving these problems.

matthewc-1’s picture

There's another problem - smtp module adds a content-type header and attempts to do it's own thing with multipart/mixed messages. Basically if mass_contact adds an attachment, smtp module messes up the headers such that for some recipients the email appears garbled.

I'm not sure if there is an easy way round this, since there is no hook in drupal_mail_wrapper to pass an attachment separately from the body of the message.

In the situation I'm using, the ability to send attachments with mass_contact messages is essential. I'm contemplating moving hosts so we can use mail() directly rather than the smtp module, but I'll work on a patch for smtp for a while longer first.

I'm not quite sure I understand the "multiple senders" issue you describe. If you can post more details or contact me individually, I'll try to look at that while I have my head in the smtp module code.

http://carroll.org.uk/contact

Thanks
Matthew

oadaeh’s picture

Re: content-type header

There are a few patches existing that attempt to correct various problems with the headers the SMTP Auth. module creates. I don't think any of them deal directly with attachments, but there still might be a fix there.

Re: multiple senders

In my testing of Mass Contact with SMTP Auth., when I would send test messages to multiple recipients, and the SMTP Auth. module would treat the multiple addresses as a single address, not matter how I configured the To: string. This is the issue where it is discussed: http://drupal.org/node/165950

matthewc-1’s picture

I think I see the problem you encountered with multiple "to" recipients. smtp module takes the $to from drupal_mail_wrapper() - which can contain multiple "to" recipients - and passes that straight to phpmailer's AddAddress() function - which should only receive one recipient at a time. That's a fairly ugly bug.

I've patched smtp to work around that, and also to work around the headers issue. It's a bit of a hack, but it seems to work for the site I'm developing at the moment.

See the bug report in smtp for the updated patch:

http://drupal.org/node/188624

oadaeh’s picture

Status: Active » Fixed

I've submitted the patch for the SMTP module and I believe I've corrected this module so that it behaves properly with the SMTP module.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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