use of com.icegreen.greenmail.test.util.GreenMailMimeMessage in project greenmail by greenmail-mail-test.
the class EscapingTest method testEscapeMessageID.
@Test
public void testEscapeMessageID() throws MessagingException {
String to = "foo@localhost";
String from = "bar`bar <bar@localhost>";
String subject = "Bad IMAP Envelope";
String body = "Example text";
greenMail.setUser(to, to);
Session smtpSession = greenMail.getSmtp().createSession();
GreenMailMimeMessage mimeMessage = new GreenMailMimeMessage(smtpSession);
mimeMessage.setRecipients(Message.RecipientType.TO, to);
mimeMessage.setFrom(from);
mimeMessage.setSubject(subject);
mimeMessage.setText(body);
GreenMailUtil.sendMimeMessage(mimeMessage);
greenMail.waitForIncomingEmail(5000, 1);
retrieveAndCheck(greenMail.getImap(), to, from, subject);
}
Aggregations