0

We use Webform Drupal 8 module to handle newsletter subscription on a website. An html formatted email is sent to confirm subscription. Unfortunately, this email is sent with only content-type:text/html, and you know how picky Spamassassin is about this. It's a real deliverability issue. We'd like to be able to send that email with a content-type:multipart/alternative, with 2 parts : one with text/html content-type and one with text/plain. How can we do this ? We installed "mail system" and "mime mail" modules, but we can't figure out how to use them, or even if it's the right solution. Has anyone ever managed to do this?

3
  • 1
    No we don't know that, the spam score for HTML mail is usually completely negligible. Check your mails on mail-tester.com, you're most likely fixing the wrong problem
    – Hudri
    Jun 16 at 21:07
  • I agree with @Hudri. Make sure you have added a PSF record, DKIM and DMARC to your DNS. Othewise, you'll likely land in the Spam box.
    – No Sssweat
    Jun 21 at 8:39
  • Usually negligible yes, but not for a major french ISP :/ We finally added a text version via hook_mail_alter. With the exception of DKIM, which I expect to be implemented soon in our IS, and which costs us a whole point on mail-tester.com, everything is ok (9/10). Jun 22 at 10:06
0

You can't do this with Drupal core, you need a helper module like Mime Mail.

The Webform module only does the minimum - it sets the content-type header but does not deal with multipart messages, does not deal with embedding images, embedding CSS/JS, re-writing URLs to be absolute, or adding attachments, etc.

The Mime Mail module was specifically written to allow any Drupal module to send multipart/alternative email with the above features.

You say you can't figure out how to use it? There's some really good documentation at https://www.drupal.org/docs/contributed-modules/mime-mail that should help.

1
  • Thanks, we've finally implemented hook_mail_after to achieve our goal, but we'll take a closer look at mime-mail. Jun 22 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.