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?

  • 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
    Commented Jun 16, 2021 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
    Commented Jun 21, 2021 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). Commented Jun 22, 2021 at 10:06

1 Answer 1


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.

  • Thanks, we've finally implemented hook_mail_after to achieve our goal, but we'll take a closer look at mime-mail. Commented Jun 22, 2021 at 9:59
  • I guess I wonder why you bothered to ask - I answered within a few hours of your post but you had already gone off in a different direction. Seems like I wasted my time answering you ...
    – anonymous
    Commented Oct 31, 2021 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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