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'shook_mail
implementation - then I print
$body
in mymimemail-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 ? ;)
Regards,