I'm using the Mimemail, Mail System and SMTP Authentication Support modules (plus a few others) to send html email. I'm basically following these guidelines, except I'm using Mimemail instead of Htmlmail so I will have the option of sending attachments in the future.

I have this working on another server, so I'm sure this is a configuration issue, but right now any emails I send out as HTML come through Gmail like this:

enter image description here

I have seen this happen a number of times so far and have figured out a few of the causes, but my guess is that it is on Drupal's side, probably when mimemail/htmlemail is composing the email.

I have seen this break down like this when:

  • an <html> tag was included in my markup

  • some tags included valid microdata attributes

  • but also when using this test string:

    <div style="width:500px; margin: 20px auto; color:green;">test</div>

I don't know what the underlying problem is, which makes it hard to troubleshoot. Has anyone else experienced this? What's going on?

The raw content of the email is as follows:

Delivered-To: [email protected]
Received: by with SMTP id ia10csp225196qdb;
        Tue, 14 Jan 2014 13:10:59 -0800 (PST)
X-Received: by with SMTP id ks2mr6855038qeb.14.1389733858933;
        Tue, 14 Jan 2014 13:10:58 -0800 (PST)
Return-Path: <[email protected]>
Received: from mail-qe0-f42.google.com (mail-qe0-f42.google.com [])
        by mx.google.com with ESMTPS id ni15si2151378qeb.90.2014.
        for <[email protected]>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 14 Jan 2014 13:10:58 -0800 (PST)
Received-SPF: neutral (google.com: is neither permitted nor denied by best guess record for domain of [email protected]) client-ip=;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: is neither permitted nor denied by best guess record for domain of [email protected]) [email protected]
Received: by mail-qe0-f42.google.com with SMTP id b4so205383qen.15
        for <[email protected]>; Tue, 14 Jan 2014 13:10:58 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
X-Gm-Message-State: ALoCoQn44cG6SY12THEWYWjpjhN40xzudvrqezMfoTbnIw0tyyVXtPNxjvWTg+sz7T5JCN8lWCC2
X-Received: by with SMTP id v8mr7141008qae.52.1389733858586;
        Tue, 14 Jan 2014 13:10:58 -0800 (PST)
Return-Path: <[email protected]>
Received: from staging.burlingtonelectric.com ([])
        by mx.google.com with ESMTPSA id g10sm2538269qaf.9.2014.
        for <[email protected]>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Tue, 14 Jan 2014 13:10:57 -0800 (PST)
Date: Tue, 14 Jan 2014 16:10:55 -0500
Return-Path: [email protected]
To: [email protected]
From: "Burlington Electric Dept." <[email protected]>
Reply-to: [email protected]
Subject: Thank you for contacting Burlington Electric!
Message-ID: <[email protected]>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Type: multipart/alternative;

Content-Type: text/plain; charset = "UTF-8"
Content-Transfer-Encoding: 8Bit


Content-Type: text/html; charset = "UTF-8"
Content-Transfer-Encoding: 8Bit


  [[this goes on for ~3000 lines]]


  • Depending on your email client, you should be able to look at the raw source of your message and from there look for clues as to what's going on
    – Jimajamma
    Jan 14, 2014 at 21:47
  • Looks like the mime encoded attachment. Do NOT include html or body tags in the email. See the mime mail's doc. It says mimemail module has its own tpl.php files with the HTML stuff included. Also, you don't need HTMLmail AND mimemail to send email attachments. mimemail module alone can do the job really well.
    – AKS
    Jan 14, 2014 at 22:14
  • @AyeshK: agreed. I am getting this result using only mimemail (not htmlmail) when I send the html content of <div style="width:500px; margin: 20px auto; color:green;">test</div>.
    – doub1ejack
    Jan 15, 2014 at 17:11
  • interestingly, the jibberish that is coming through in these emails is identical every time..
    – doub1ejack
    Feb 13, 2014 at 19:31
  • 2
    as @wesruv somehow mentioned it seems Content-Transfer-Encoding is base64 but mistakenly indicated as 8bit. if you use mimemail 7.x-1.0-beta1 change Content-Transfer-Encoding from 8bit to base64 in line of 294 of mimemail.inc file and tell the result.
    – sepehr
    Feb 16, 2014 at 13:13

2 Answers 2


I've asked a friend that has e-mail experience. He's saying that the e-mail header is saying the encoding is text, but the garbled text looks like Base64 encoding. I'm using Mimemail quite a bit and never ran into this issue...

Any strange config to speak of?

I went to this site: http://www.opinionatedgeek.com/dotnet/tools/base64decode/ and pasted in the first part of your garbled text and got this:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
      .clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:tigcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px a

I'm assuming that looks familiar. So I can tell you that your encoding is wrong, but as to how to fix that...

  • Thanks for your answer. Turns out I was missing a second email that was sending some obsolete html (<font> tags in particular). When I removed this html, the problem went away. I think you are right that it is an encoding issue, but I don't know which part of the Mimemail/Mail System/SMTP stack was choking. I think the lesson here is that this configuration is somewhat tender and html needs to be tested carefully.
    – doub1ejack
    Feb 19, 2014 at 21:21

--b1_4a65e76f1c8243dcfd2db906a0c0a45d Content-Type: text/html; charset = "UTF-8" Content-Transfer-Encoding: 8Bit


The issue is incorrect encoding value in mail when the content is encoded Content-Transfer-Encoding: 8Bit ==> needs to be Content-Transfer-Encoding: base64

Though the multi-part MIME content is encoded, it's value is shown as 8Bit in the mail content pasted above.

If you open saved .eml file in notepad and change that one line and save it (as .eml), it will open properly in any mail client!

  • Is this encoding error consistent with the comment I left on the answer from @wesruv?
    – doub1ejack
    Feb 3, 2015 at 15:32

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.