Mass Contact creates the entire email, including headers, which includes Content-Type and Bcc. When htmlmail_mail_alter gets called, all the work that module did gets trashed. The entire header array is totally replaced with a single-element array with the key "Content-Type".
Could the functionality of htmlmail be extended s.t. if the message header already contains a Content-Type that indicates HTML, don't replace it?
Also, could htmlmail preserve all those other important header fields that we had before its mail_alter got called?
How about this logic:
When htmlmail_mail_alter gets called, see if $message is a content type of "multipart*". If it *is*, then see if the body contains a content-type of text/html somewhere in the body. If it *does*, then skip the construction of the header.
On the other hand, if $message does have a header, but that header doesn't already specify a content-type, just *add* the content-type value, don't totally replace everything in the header.
Is this an inherently unsafe approach?
Thanks
Comments
Comment #1
mhdg commentedTake a look at the dev version as it should solve your issue !
Enjoy,
Michel
Comment #2
Christopher Herberte commentedyep, fixed in dev.
Comment #3
simenro commentedNot fixed in dev for me.
However when I replace the first statement in htmlmail_mail_alter() with this, it works for me:
$message['headers'] = str_replace('text/plain', 'text/html', $message['headers']);