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("[email protected]")));
                email.setFrom("[email protected]");
                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

Reply via email to