0

My app is constructing emails that are both plain text and HTML but GMail is displaying the plain text part instead of the HTML one. This is a sample generated email:

Delivered-To: pupeno@pupeno.com
Received: by 10.202.226.2 with SMTP id z2csp41072oig;
        Wed, 21 Oct 2015 09:54:39 -0700 (PDT)
X-Received: by 10.60.140.228 with SMTP id rj4mr7305493oeb.15.1445446479023;
        Wed, 21 Oct 2015 09:54:39 -0700 (PDT)
Return-Path: <bounces+2027321-a574-pupeno=pupeno.com@email.carouselapps.com>
Received: from o1.email.carouselapps.com (o1.email.carouselapps.com. [198.21.7.128])
        by mx.google.com with ESMTPS id i13si6011737oig.46.2015.10.21.09.54.38
        for <pupeno@pupeno.com>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 21 Oct 2015 09:54:38 -0700 (PDT)
Received-SPF: pass (google.com: domain of bounces+2027321-a574-pupeno=pupeno.com@email.carouselapps.com designates 198.21.7.128 as permitted sender) client-ip=198.21.7.128;
Authentication-Results: mx.google.com;
       spf=pass (google.com: domain of bounces+2027321-a574-pupeno=pupeno.com@email.carouselapps.com designates 198.21.7.128 as permitted sender) smtp.mailfrom=bounces+2027321-a574-pupeno=pupeno.com@email.carouselapps.com;
       dkim=pass header.i=@carouselapps.com
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=carouselapps.com; 
    h=from:to:subject:mime-version:content-type; s=s1; 
    bh=tOXLoNNj+tA5sKyUrxTrMBkqGQ4=; b=Q6rZfviL8wvK5S7zn05O3o+tnzHp7
    ohOlidmKSRY6eJcItQsvqQQPUHxGfR/IdKBEpF8aQXCptHzx6/QBiTF6QahozKcz
    c9m4KGCDnZCdjR5sgD49pYUdXHf5ZZT9qMuDPi2oWd3FPNUhnD2jSV8TwH8qoA6s
    mZAcoxcqvcS5cE=
Received: by filter0555p1mdw1.sendgrid.net with SMTP id filter0555p1mdw1.10068.5627C3451A
        2015-10-21 16:54:29.132861171 +0000 UTC
Received: from 192.168.1.103 (53.23.169.217.in-addr.arpa [217.169.23.53])
    by ismtpd0003p1lon1.sendgrid.net (SG) with ESMTP id pHhKi9tmTESQOhfQeWHH7Q
    for <pupeno@pupeno.com>; Wed, 21 Oct 2015 16:54:29.152 +0000 (UTC)
Date: Wed, 21 Oct 2015 17:54:28 +0100 (BST)
From: Ninja Tools <info@tools.screensaver.ninja>
To: pupeno <pupeno@pupeno.com>
Message-ID: <j2kKE4orTaIPAzuu5NNTdg.1445446468738@postal.enterprise>
Subject: Reset your password for Ninja Tools
MIME-Version: 1.0
Content-Type: multipart/alternative; 
    boundary="----=_Part_0_1497473158.1445446468708"
User-Agent: postal/1.11.1
X-SG-EID: OKPjcrZQ6zDhIRONmJRumzza0qf5A75AqxbEBKEWUbq4dRn30/O1kqcj+YBUC+lbjYMywbswqYg7Qh
 RQW+GwImU2lbSyt8hhxbLjmPoYyDpgK8fw4j9gyRo6iN3Ifa6WXnIc19Wgt8ckU+k3Ia98r9m74+uq
 UP5oIuLP/0QrO2c=

------=_Part_0_1497473158.1445446468708
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<p>Hello pupeno</p>

<p>We just received a request to reset your password for Ninja Tools. If you requested it, go ahead and
    <a href="http://links.carouselapps.com/wf/click?upn=WfPzVLtb7ZF35VAdtBHlPvSQvCzieCVyZbs3rAQB-2F3b4FEWT6XE-2F5IT5D7g8XqMsWbVR0RLAOhF7yR9BCW6sg75Dp2sRKl-2FRgqE8gYDigkp0rl-2FRQr3ZBALDyTSWMY84_H-2FlUQYAvQPwDWbL-2FScCT8JuGY0xejfYki4Bcr-2F29kvOaFEyLudYEogQpRlVyY72hMcXzoSJtZs1jqx-2FezjofLTqaYlVMMbijAqWWwUGmbbSleIrNBjtJIFr3aZTGFGb0A84kijruYdrr28Ux5b-2FKY4o4p2IQryVKRxJlHm6Uq6CZFrlbft3-2FzVvgTFCmDcMB-2BqNYJ9fvnEpXQO3DBfG6xw-3D-3D">change your password</a>.</p>

<p>If it wasn't you, it's probably nothing to worry about, but you can change your password if you want. We recommend
    using long random passwords that are impossible to guess, generated by one of the many tools for this purpose.</p>

<p>--<br/>
<a href="http://links.carouselapps.com/wf/click?upn=aOZ8fPA8TW6xA-2FK-2FYLRnf6pYmLjc3DT199mO9iLMlb-2BwBDAOJfISw0s-2FCqQ5XiNd_H-2FlUQYAvQPwDWbL-2FScCT8JuGY0xejfYki4Bcr-2F29kvOaFEyLudYEogQpRlVyY72hf07emq5eDBLFNRYWfauKdadaeOkonVSXkr44a2TsLAwfGvVKNTgV-2BQftjAORHK4eqJJNBbsRgHaZerIZCV-2FuE2aQCEVqHKzjuYrgw9-2BNJYYYNZhzhDKYXAemcLXg2DONFOMMyAisrJ4sZtAg7Ul9Rg-3D-3D">The Ninja Tools team<br/>
tools.screensaver.ninja</a></p>
<img src="http://links.carouselapps.com/wf/open?upn=H-2FlUQYAvQPwDWbL-2FScCT8JuGY0xejfYki4Bcr-2F29kvOaFEyLudYEogQpRlVyY72hneRNq82X61ObdxFETqc6Fs7FKZMztlkd6uWh4LFi7chevjbn4gwRY5bASZDbTuzhgxOj0Hi-2FuCiMJCX8Ct3egGOqidXFik-2FWi-2F5r8w7CWUzpZvlMJnTmQs-2Fef1QyiuE3A9tuex-2B-2F-2BLIDoKhAwnxz8pNyCpnX8U5JVqNlydpAhiw-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>

------=_Part_0_1497473158.1445446468708
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello pupeno,

We just received a request to reset your password for Ninja Tools. If you requested it, go to

http://links.carouselapps.com/wf/click?upn=WfPzVLtb7ZF35VAdtBHlPvSQvCzieCVyZbs3rAQB-2F3b4FEWT6XE-2F5IT5D7g8XqMsWbVR0RLAOhF7yR9BCW6sg75Dp2sRKl-2FRgqE8gYDigkp0rl-2FRQr3ZBALDyTSWMY84_H-2FlUQYAvQPwDWbL-2FScCT8JuGY0xejfYki4Bcr-2F29kvOaFEyLudYEogQpRlVyY72h16QDQLQ3Y-2BAwzKSTkHHzzQU8t5NMDhhwFxr-2F9kPJnrpNWf6bVxL-2B3kECV2sts-2Bhs7B4xqorGBxtneHsySFrAt-2FmbHS1C9j4O2pNSoP2dEhp-2B0w2jLrXHf33RIEnZf19evu4H-2BC9k6zjgzxaDIZQfhg-3D-3D

and set a new password.

If it wasn't you, it's probably nothing to worry about, but you can change your password if you want. We recommend using
long random passwords that are impossible to guess, generated by one of the many tools for this purpose.

--
The Ninja Tools team
http://links.carouselapps.com/wf/click?upn=z585DblkaMQy4JfRqwCa4OVAx8ziqEgRXDflOVJFKdB-2F9oZCqNqfkkoKugMxgyzH_H-2FlUQYAvQPwDWbL-2FScCT8JuGY0xejfYki4Bcr-2F29kvOaFEyLudYEogQpRlVyY72h-2BGkBmxTO1QKUGbbWcp2ur1bXMQCsapPIB9JTm2TpH6AzlTKnRjNocUYmBMOx9VP-2BzaKLweZ56O5sLXW5P-2F9-2BGdAnIFF03EgATc2bgZW6Cz9ZpUFBbdrYbcSrQN07G-2BtyJilqYNGqGLkBOPZLY8-2BV3A-3D-3D

------=_Part_0_1497473158.1445446468708--

Is there anything wrong with it?

The code I'm using to generate it, in case it's relevant, is:

(mailer/deliver-email {:to      (str (user-schema/display-name user) " <" (:email user) ">")
                       :subject "Reset your password for Ninja Tools"}
                      "templates/email/reset-password.html.mustache" template-vars :text/html
                      "templates/email/reset-password.txt.mustache" template-vars :text/plain)))
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
  • Please update the tags on your question to show what language you're using to generate the email. It's not familiar to me, so is the code you're posted a complete example? Also have you tried running the email that's generated through a validator? – j08691 Oct 21 '15 at 17:10
  • 2
    @j08691 the language is irrelevant, if someone points be about the problem with the email, I can fix it. By adding the tag I'll just make everybody that doesn't know the language skip a language-agnostic question. – Pablo Fernandez Oct 21 '15 at 17:12
  • I found a solution here: http://stackoverflow.com/questions/5188605/gmail-displays-plain-text-email-instead-html – Pablo Fernandez Oct 21 '15 at 17:15

0 Answers0