When checking the option Provide simple plain/text alternative of the HTML mail to send multipart emails, I'm getting this warning:

Notice: Uninitialized string offset: -1 em SmtpMailSystem->_get_substring() (linha 734 de ./modules/contrib/smtp/smtp.mail.inc).

Also I'm getting an undesirable string ($boundary and content-type) on the of my email body:

np57b704049e36f Content-type: text/html;charset=utf-8

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tregismoreira created an issue. See original summary.

monstrfolk’s picture

This is due to using HTML Mail with SMTP Authentication module. Don't know if the bug is because of this module or SMTP Authentication module.

See here... https://www.drupal.org/node/2847707

monstrfolk’s picture

This is a problem with this module.

Content-type should be Content-Type

This....
multipart/alternative;boundary=np588cdd5569378

Should be.... (boundary key is wrapped in quotations)
multipart/alternative;boundary="np588cdd5569378"

Looks like someone got tired while coding :)

monstrfolk’s picture

Status: Active » Needs review
salvis’s picture

Status: Needs review » Needs work

Thank you for the analysis and patch, monstrfolk!

+++ b/htmlmail.mail.inc
@@ -123,14 +123,14 @@ class HTMLMailSystem implements MailSystemInterface {
+          $message['headers']['Content-Type'] = 'multipart/alternative;boundary="' . $boundary . '""';

Two double-quotes cannot be right.

Also, according to the example in https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html the double quotes are not mandatory, but I guess the don't hurt.

monstrfolk’s picture

Looks like I got tired while coding. My IDE added extra quotes and I did not notice. Also, found 2 small spelling mistakes.

monstrfolk’s picture

Status: Needs work » Needs review

  • salvis committed 086c9a1 on 7.x-2.x
    Issue #2786907 by monstrfolk: Issues related to multipart/alternative...
salvis’s picture

Status: Needs review » Fixed

Thanks, monstrfolk!

Status: Fixed » Closed (fixed)

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