@Test
    void testSendTwoMsgsWithLogin() throws MessagingException, IOException {
        final String From = "sender@here.com";
        final String To = "receiver@there.com";
        final String Subject = "Test";
        final String body = "Test Body";

        final Session session = Session.getInstance(this.getMailProperties(smtpServer.getPort()), null);
        final Message msg = new MimeMessage(session);
        msg.setFrom(new InternetAddress(From));
        msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(To, false));
        msg.setSubject(Subject);

        msg.setText(body);
        msg.setHeader("X-Mailer", "musala");
        msg.setSentDate(new Date());

        Transport transport = null;

        try {
            transport = session.getTransport("smtp");
            transport.connect(HOST_NAME, smtpServer.getPort(), "ddd", "ddd");
            assertEquals(0, storingMessageListener.getMessages().size());
            transport.sendMessage(msg, InternetAddress.parse(To, false));
            assertEquals(1, storingMessageListener.getMessages().size());
            transport.sendMessage(msg, InternetAddress.parse("dimiter.bakardjiev@musala.com", false));
            assertEquals(2, storingMessageListener.getMessages().size());
        } finally {
            if (transport != null) {
                transport.close();
            }
        }

        final Iterator<StoredMessage> emailIter = storingMessageListener.getMessages().iterator();
        final StoredMessage email = emailIter.next();
        final MimeMessage mime = email.getMimeMessage();
        assertEquals("Test", mime.getHeader("Subject")[0]);
        assertEquals("Test Body" + "\r\n", mime.getContent().toString());
    }
See
<a href="http://sourceforge.net/tracker/index.php?func=detail&amp;aid=1474700&amp;group_id=78413&amp;atid=553186">...</a>
for discussion about this bug

@throws IOException        on IO error
@throws MessagingException on messaging error
src/test/java/de/gessnerfl/fakesmtp/smtp/SmtpComplianceIntegrationTest.java