You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dominik Stadler (JIRA)" <ji...@apache.org> on 2012/10/16 07:05:05 UTC

[jira] [Created] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject

Dominik Stadler created EMAIL-121:
-------------------------------------

             Summary: 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
            Priority: Critical


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:

{quote}
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();
	}
{quote}

--
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

[jira] [Resolved] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ 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

[jira] [Updated] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated EMAIL-121:
-----------------------

    Priority: Major  (was: Critical)
    
> 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

[jira] [Updated] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject

Posted by "Dominik Stadler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Stadler updated EMAIL-121:
----------------------------------

    Description: 
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}

  was:
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:

{quote}
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();
	}
{quote}

    
> 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
>            Priority: Critical
>         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

[jira] [Commented] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/EMAIL-121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476864#comment-13476864 ] 

Sebb commented on EMAIL-121:
----------------------------

Does SMTP allow newLines in subjects?

Line-breaks are used to wrap long lines, so may occur in the transmitted data, but these should be removed by the receiver before display.
                
> 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

[jira] [Updated] (EMAIL-121) Outlook displays an email incorrectly if there is a newline in the Subject

Posted by "Dominik Stadler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/EMAIL-121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Stadler updated EMAIL-121:
----------------------------------

    Attachment: mail-wrong.png
                mail-ok.png

display of the email in Outlook without and with newline
                
> 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
>            Priority: Critical
>         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:
> {quote}
> 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();
> 	}
> {quote}

--
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