Mail from mendix

4
We're sending notifications from our app to users. Sometimes the mail isn't html. How can that be? We're using a java action send the mail away. Example of a mail in my outlook: Filter staat op 2010, maar niet alles van 2010 wordt getoond. MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_12_426008374.1288078572908" ------=_Part_12_426008374.1288078572908 Content-Type: multipart/alternative; boundary="----=_Part_13_212262720.1288078572908" ------=_Part_13_212262720.1288078572908 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit
asked
3 answers
4
Content-Type: text/plain; charset="UTF-8"

Shouldn't it be Content-Type: text/html; ?

Update

Based on the Email module source, a MIME part with 'text/html' will be added if the HTML text is set. So it appears that either htmlMessage is empty, or that you did not list the full message.

Note however that

   message.replace("\n", "<br/>");

does not turn your message magically into HTML! You need to encode all the text to valid html entities (there are useful functions for that in the apache.org libraries). So I can imagine that e-mail clients won't show your message as soon as it contains any special character, since you do NOT provide valid HTML.

answered
2

Samet didn't post the entire mail content (see below), but the problem here wasn't the content of the mail (which did correctly contain a text/html part). The issue was a line break in the subject of the mail, which caused the mail not to recognized as a MIME message by the mail client.

The complete mail was:

From: ...
Send: Tuesday, October 26, 2010 9:36 AM
To: ...
Subject: Update action: Filter bij onkosten overzicht niet goed.

Filter
 staat op 2010, maar niet alles van 2010 wordt getoond.
MIME-Version: 1.0
Content-Type: multipart/mixed; 
    boundary="----=_Part_12_426008374.1288078572908"

------=_Part_12_426008374.1288078572908
Content-Type: multipart/alternative; 
    boundary="----=_Part_13_212262720.1288078572908"

------=_Part_13_212262720.1288078572908
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit

There are is an update for action: Filter bij onkosten overzicht niet goed.
Filter staat op 2010, maar niet alles van 2010 wordt getoond..
Number: 395

Please go to http://some.url/ and check the updates.
------=_Part_13_212262720.1288078572908
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: 7bit

There are is an update for action: Filter bij onkosten overzicht niet goed.<br/>Filter staat op 2010, maar niet alles van 2010 wordt
getoond..<br/>Number: 395<br/><br/>Please go to http://some.url/ and check the updates.
------=_Part_13_212262720.1288078572908--

------=_Part_12_426008374.1288078572908--
answered
1

We found the error: an enter in the mail subject. We've replaced the attribute which was set in the mail subject. Thanks for your help!

answered