Should be smarter about headers
| Project: | HTML Mail |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
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

#1
Take a look at the dev version as it should solve your issue !
Enjoy,
Michel
#2
yep, fixed in dev.
#3
Not 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']);
#4
Automatically closed -- issue fixed for 2 weeks with no activity.