voodoodyne / subethasmtp

SubEtha SMTP is a Java library for receiving SMTP mail
Other
343 stars 138 forks source link

message.getMimeMessage().getSubject() returns null #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Simple test case 

public class SendMailTest() {
    private Wiser wiser;

    @Before
    public void setup() throws Exception {
        wiser = new Wiser();
        wiser.setPort(2500);
        wiser.start();
    }

    @After
    public void tearDown() throws Exception {
        wiser.stop();
    }

    @Test
    public void testSendMail() throws Exception {
        Properties props = new Properties();
        props.put("mail.smtp.host", "localhost");
        props.put("mail.smtp.port", "2500");
        Session session = Session.getInstance(props, null);
        try {
            Message message = new MimeMessage(session);
            message.setFrom(new InternetAddress("from-email@gmail.com"));
            message.setRecipients(Message.RecipientType.TO,
                    InternetAddress.parse("to-email@gmail.com"));
            message.setSubject("Test Subject");
            message.setText("Test message");
            Transport.send(message);
            System.out.println("Sent");

            assertThat(wiser.getMessages().size(), equalTo(1));

            WiserMessage wiserMessage = wiser.getMessages().get(0);
            System.out.println("Subject: " + wiserMessage.getMimeMessage().getSubject());

        } catch (MessagingException e) {
            throw new RuntimeException(e);
        }
    }
}

What is the expected output? What do you see instead?
Expected: Subject: Test Subject

Got: Subject: null

What version of the product are you using? On what operating system?
subethasmtp-3.1.7.jar on Windows

Please provide any additional information below.

Original issue reported on code.google.com by hhu...@gmail.com on 27 May 2013 at 5:53

GoogleCodeExporter commented 9 years ago
I had found the problem. There seems to be a bug with 
org.apache.openejb:javaee-api:5.0-2. Taking it out of my classpath solves the 
problem. 

Original comment by hhu...@gmail.com on 28 May 2013 at 12:16

GoogleCodeExporter commented 9 years ago

Original comment by hontvari@flyordie.com on 28 May 2013 at 7:59