1

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: micah.mutrux@gmail.com
Received: by 10.96.110.138 with SMTP id ia10csp225196qdb;
        Tue, 14 Jan 2014 13:10:59 -0800 (PST)
X-Received: by 10.49.119.66 with SMTP id ks2mr6855038qeb.14.1389733858933;
        Tue, 14 Jan 2014 13:10:58 -0800 (PST)
Return-Path: <brandthropologist@brandthropology.com>
Received: from mail-qe0-f42.google.com (mail-qe0-f42.google.com [209.85.128.42])
        by mx.google.com with ESMTPS id ni15si2151378qeb.90.2014.01.14.13.10.58
        for <micah.mutrux@gmail.com>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Tue, 14 Jan 2014 13:10:58 -0800 (PST)
Received-SPF: neutral (google.com: 209.85.128.42 is neither permitted nor denied by best guess record for domain of brandthropologist@brandthropology.com) client-ip=209.85.128.42;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 209.85.128.42 is neither permitted nor denied by best guess record for domain of brandthropologist@brandthropology.com) smtp.mail=brandthropologist@brandthropology.com
Received: by mail-qe0-f42.google.com with SMTP id b4so205383qen.15
        for <micah.mutrux@gmail.com>; 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;
        h=x-gm-message-state:date:to:from:reply-to:subject:message-id
         :mime-version:content-type;
        bh=q863iUWoCdb0QZ/E9G4JcaTazlYbBVv/2KBPGt9MjWE=;
        b=R/76jgNUVqjJAKnHYvDDo9wbdQ3CJRm0xEbsk25O2ZstnH2uqcRNxJ4imF+5a2JaSq
         0rJRp4buE44SnVrfeNthjUFo1WB6+9P26PHFlh1PPXQp2RAc5Wyjz1TB2ZHIKj0roWNr
         iBnLThIB2OCIcdgKDElEkUDC/cYm6AlGcvfidFWPQqffjdSMC5u+fDZ/8xCnH4DsTXud
         HMIGvFxQvuoYEIvj8ZEbaQwWxnI1bSDyKKr/BPNaz3l4wpB41NknyFID191hYnPsaoiX
         SaS1AzxSbOiHJRBBqEvAm45HtQvvxo2aOTCatZ+I1j6OG33DP2jiNmwlmab1MvBg4ecC
         ndLQ==
X-Gm-Message-State: ALoCoQn44cG6SY12THEWYWjpjhN40xzudvrqezMfoTbnIw0tyyVXtPNxjvWTg+sz7T5JCN8lWCC2
X-Received: by 10.224.43.72 with SMTP id v8mr7141008qae.52.1389733858586;
        Tue, 14 Jan 2014 13:10:58 -0800 (PST)
Return-Path: <brandthropologist@brandthropology.com>
Received: from staging.burlingtonelectric.com ([64.207.185.89])
        by mx.google.com with ESMTPSA id g10sm2538269qaf.9.2014.01.14.13.10.57
        for <micah.mutrux@gmail.com>
        (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: brandthropologist@brandthropology.com
To: micah.mutrux@gmail.com
From: "Burlington Electric Dept." <brandthropologist@brandthropology.com>
Reply-to: brandthropologist@brandthropology.com
Subject: Thank you for contacting Burlington Electric!
Message-ID: <4a65e76f1c8243dcfd2db906a0c0a45d@staging.burlingtonelectric.com>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_4a65e76f1c8243dcfd2db906a0c0a45d"


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

test


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

PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRl
bnQ9InRleHQvaHRtbDsgY2hhcnNldD11dGYtOCIgLz4KICAgICAgICA8c3R5bGUgdHlwZT0idGV4
dC9jc3MiPgogICAgICA8IS0tCiAgICAgIC5jbGVhcmZpeHsqem9vbToxfS5jbGVhcmZpeDpiZWZv
cmUsLmNsZWFyZml4OmFmdGVye2Rpc3BsYXk6dGFibGU7bGluZS1oZWlnaHQ6MDtjb250ZW50OiIi
fS5jbGVhcmZpeDphZnRlcntjbGVhcjpib3RofS5oaWRlLXRleHR7Zm9udDowLzAgYTtjb2xvcjp0
aWdjYXB0aW9uLGZpZ3VyZSxmb290ZXIsaGVhZGVyLGhncm91cCxuYXYsc2VjdGlvbntkaXNwbGF5
OmJsb2NrfWF1ZGlvLGNhbnZhcyx2aWRlb3tkaXNwbGF5OmlubGluZS1ibG9jazsqZGlzcGxheTpp
bmxpbmU7Knpvb206MX1hdWRpbzpub3QoW2NvbnRyb2xzXSl7ZGlzcGxheTpub25lfWh0bWx7Zm9u
dC1zaXplOjEwMCU7LXdlYmtpdC10ZXh0LXNpemUtYWRqdXN0OjEwMCU7LW1zLXRleHQtc2l6ZS1h
ZGp1c3Q6MTAwJX1hOmZvY3Vze291dGxpbmU6dGhpbiBkb3R0ZWQgIzMzMztvdXRsaW5lOjVweCBh

  [[this goes on for ~3000 lines]]

aGVhZD4KICA8Ym9keSBpZD0ibWltZW1haWwtYm9keSIgY2xhc3M9Im1pbWVtYWlsLWNvbnRhY3Qt
dXMtbm90aWZ5LXNlbmRlciI+CiAgICA8ZGl2IGlkPSJjZW50ZXIiPgogICAgICA8ZGl2IGlkPSJt
YWluIj4KICAgICAgICA8ZGl2IHN0eWxlPSJ3aWR0aDo1MDBweDsgbWFyZ2luOiAyMHB4IGF1dG87
Ij4KdGVzdAo8L2Rpdj4gICAgICA8L2Rpdj4KICAgIDwvZGl2PgogIDwvYm9keT4KPC9odG1sPgo=



--b1_4a65e76f1c8243dcfd2db906a0c0a45d--
  • 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 '14 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. – AyeshK Jan 14 '14 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 '14 at 17:11
  • interestingly, the jibberish that is coming through in these emails is identical every time.. – doub1ejack Feb 13 '14 at 19:31
  • 1
    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 '14 at 13:13
3
+25

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:

<html>
  <head>
    <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 '14 at 21:21
1

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

PGh0bWw+CiAgPGhlYWQ+CiAgI

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 '15 at 15:32

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.