Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multipart email implementation #1009

Merged
merged 1 commit into from Sep 29, 2017

Conversation

alin-amana
Copy link
Contributor

  • Don't send parts with empty templates.
  • Add a MIME-Version: 1.0 header.
  • Place text/html part last, as parts are supposed to be in increasing preference order.

This is a follow-up fix to #934.

 * Don't send parts with empty templates.
 * Add a MIME-Version: 1.0 header.
 * Place text/html part last, as parts are supposed to be in increasing preference order.
@alin-amana
Copy link
Contributor Author

Before and after comparison:

Delivered-To: some@email.com
Received: by 10.25.77.138 with SMTP id a132csp432651lfb;
        Fri, 29 Sep 2017 00:13:20 -0700 (PDT)
X-Google-Smtp-Source: AOwi7QBw45PjRByr92ePhztjWK0h6nvpk6GTy3YVQA6NNJCSAGw6LtNUBdBWipoqgDbKWrkPs2PZ
Subject: [FIRING:1] TasksMissing prod move (prometheus warning)
[...]
To: some@email.com
From: other@email.com
Date: Fri, 29 Sep 2017 09:13:19 +0200
Content-Type: multipart/alternative;
  boundary=24661a476b9504ed63d9a026bf66467e71cb80058587a7b2e4e3e3e62352

--24661a476b9504ed63d9a026bf66467e71cb80058587a7b2e4e3e3e62352
Content-Type: text/html; charset=UTF-8


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
[...]
</html>


--24661a476b9504ed63d9a026bf66467e71cb80058587a7b2e4e3e3e62352
Content-Type: text/plain; charset=UTF-8


--24661a476b9504ed63d9a026bf66467e71cb80058587a7b2e4e3e3e62352--

and after

Delivered-To: some@email.com
Received: by 10.25.77.138 with SMTP id a132csp500166lfb;
        Fri, 29 Sep 2017 01:39:15 -0700 (PDT)
X-Google-Smtp-Source: AOwi7QByWid50b7p/goND1hmZkpvM9+HBhen6k/9umvQr5HxEtRCRf66sJ6ddLGLqeeKZ3C7Reit
[...]
To: some@email.com
From: other@email.com
Subject: [FIRING:1] TasksMissing prod move (prometheus warning)
Date: Fri, 29 Sep 2017 10:39:14 +0200
Content-Type: multipart/alternative;
  boundary=c0e0b4448f4ad0a856383a2a74f9a50e4246c4ec99c1916632b34ced9701
MIME-Version: 1.0

--c0e0b4448f4ad0a856383a2a74f9a50e4246c4ec99c1916632b34ced9701
Content-Type: text/html; charset=UTF-8


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
[...]
</html>


--c0e0b4448f4ad0a856383a2a74f9a50e4246c4ec99c1916632b34ced9701--

Had there been a text template, it would have been in front of the HTML.

Copy link
Contributor

@stuartnelson3 stuartnelson3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed locally, looks great 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants