You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Thomas Neidhart (JIRA)" <ji...@apache.org> on 2014/09/30 22:19:33 UTC

[jira] [Commented] (EMAIL-142) HtmlEmail with both html and text provided has invalid content-type

    [ https://issues.apache.org/jira/browse/EMAIL-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14153695#comment-14153695 ] 

Thomas Neidhart commented on EMAIL-142:
---------------------------------------

The root container for the mime message will always be created with content-type multipart/mixed, but in case text and html message has been provided a child container with type multipart/alternative will be added containing the 2 messages, see the example mail below:

{code}
Date: Tue, 30 Sep 2014 22:11:35 +0200 (CEST)
From: test_from@apache.org
To: test_to@apache.org
Message-ID: <21...@tn-laptop>
Subject: [email] 1.Test: text + html content
MIME-Version: 1.0
Content-Type: multipart/mixed;
        boundary="----=_Part_9_12877540.1412107867547"

------=_Part_9_12877540.1412107867547
Content-Type: multipart/alternative;
        boundary="----=_Part_10_11984121.1412107895170"

------=_Part_10_11984121.1412107895170
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

Your email client does not support HTML messages
------=_Part_10_11984121.1412107895170
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<html><b>This is a HTML message without any image</b><html>
------=_Part_10_11984121.1412107895170--

------=_Part_9_12877540.1412107867547--
{code}

If I open this message with thunderbird, it correctly displays the HTML message.

> HtmlEmail with both html and text provided has invalid content-type 
> --------------------------------------------------------------------
>
>                 Key: EMAIL-142
>                 URL: https://issues.apache.org/jira/browse/EMAIL-142
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.3.2
>            Reporter: Marcin Tomiak
>             Fix For: 1.3.3
>
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> If I set both html and plain text for HtmlEmail i.e.:
> email.setHtmlMsg(htmlMessage);
> email.setTextMsg(plainTextMessage);
> then message which is sent has Content-type: multipart/mixed;
> This content type is recognized for example by Mozilla Thunderbird as a message with attachment.
> Correct content-type for this kind of email is Content-type: multipart/alternative;



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)