I'm trying to send HTML mails on a Drupal 7 install. For this, I use Mail System, SMTP authentication and Mime mail modules. I used settings as Alternative approach on this page http://drupal.org/node/1200142

The mail content is built within custom modules I'm writing (not by rules or simplenews, I mean). I tweaked default Mail mime template to my needs, within a separate, light drupal theme.

My mails are sent (and received) without error when they contain only HTML and styles. There are no error also when I had images with absolute url: Mime mail is leaving them as such.

I need to embed a few small images within my mails and when I try to do so, accordingly to what's written in Mime Mail README, I get a "Message body empty" at the top of my page when my code tried to send the mail.

I placed dpm($message) along the Mime mail code to locate where the body content is left empty. I finally reached the class MimeMailSystem implements MailSystemInterface located in mimemail/includes/mimemail.mail.inc

Body content was still there.

Then the class MimeMailSystem__SmtpMailSystem implements MailSystemInterface in default/files/mailsystem/MimeMailSystem__SmtpMailSystem.mail.inc

Again, my content was still there, along with inline BASE64 encoded images. So the content disappears somewhere after that (in Mail System ?)

As I pointed it out here, switching Site-wide default MailSystemInterface class in Mail System settings from MimeMailSystem__SmtpMailSystem to MimeMailSystem allows the mail to be sent with its images, but the mail is no more sent through SMTP.

I'm pretty sure this is not due to a bug within one of the 3 modules, but I can't figure what I'm doing wrong.

The only thing I doubt from here is how I build the mail content :

  • I build some variable HTML content
  • I store it in $message['body'][] in my module's hook_mail implementation
  • then I print $body in my mimemail-message.tpl.php within static HTML part of the mail

The images I try to embed are in public files. I tried to link them :

  • with relative paths like sites/default/files/<filename>
  • with relative paths like public://<filename>

with no success.

Does anyone has a magical one character solution for something I missed ? ;)


1 Answer 1


Further investigations lost me into the SMTP Authentication Support module It's complicated enough and I couldn't locate something to help me find what was the problem coming form my configuration.

After a quick search within issues of Mime mail, someone was linking to another module to handle SMTP connection: enter link description here

Basically it works the same way than SMTP Authentication support but its benefit is you don't have to create a bridge mail system class between it and Mime mail, it's natively integrating with Mime mail.

To make it work properly, I had to configure Mail system as such :

  • Site-wide default MailSystemInterface class: MimeMailSystem
  • Mime Mail module class: MimeMailSystem
  • PHPMailer module class: DrupalPHPMailer

and in Mime mail settings : - set Mail engine to PHPmailer

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.