commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject
Date Tue, 16 Oct 2012 09:53:03 GMT

     [ https://issues.apache.org/jira/browse/EMAIL-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sebb resolved EMAIL-121.
------------------------

    Resolution: Not A Problem

If you send the following subject it will work OK:

{code}sendEmail("\n Setup job '[setup,sync]' finished on machine");{code}

A line without a space in column 1 is treated as part of the message body (or a header if
it looks like one)

This is not a bug in Commons Email, which just passes the subject to JavaMail.

The work-round is: don't use new-lines in the subject field.
                
> Outlook displays an email incorrectly if there is a newline in the Subject
> --------------------------------------------------------------------------
>
>                 Key: EMAIL-121
>                 URL: https://issues.apache.org/jira/browse/EMAIL-121
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.3
>         Environment: 1.3 SNAPSHOT, Outlook "14.0.6123.5001"
>            Reporter: Dominik Stadler
>         Attachments: mail-ok.png, mail-wrong.png
>
>
> Agreed it is not very useful, but it took me quite a while to figure out why outlook
did not display the email correctly.
> Here a simplified reproducer:
> {code}
> public class EmailSendingReproducer {
> 	private static final String MESSAGE_HTML =
> 			"<html>" +
> 					"<body>" +
> 					"Sincerly<br/>" +
> 					"Your hard-working setup application<br/>" +
> 					"</body></html>";
> 	private static final String MESSAGE_TXT =
> 			"Sincerly<br/>" +
> 					"Your hard-working setup application<br/>" +
> 					"\n";
> 	public static void main(String[] args) throws Exception {
> 		sendEmail("\n1Setup job '[setup,sync]' finished on machine");
> 		sendEmail("Setup job '[setup,sync]' finished on machine");
> 		System.out.println("Done");
> 	}
> 	public static void sendEmail(String subject) throws IOException, EmailException, AddressException
{
> 		final ImageHtmlEmail email = new ImageHtmlEmail();
> 		email.setDataSourceResolver(new DataSourceResolverImpl(new File(".").toURI().toURL(),
true));
> 		// set properties on the Email object
> 		email.setHostName("somesmtphost");
> 		email.setSmtpPort(25);
> 		email.setTo(Arrays.asList(InternetAddress.parse("whereyouare@example.com")));
> 		email.setFrom("test@example.com");
> 		email.setSubject(subject);
> 		email.setMsg(MESSAGE_TXT);
> 		email.setHtmlMsg(MESSAGE_HTML);
> 		email.send();
> 	}
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message