If I send a test email to GreenMail, containing a Message-ID containing a quoted address, e.g.
<11111.22222.3333.JavaMail."FOO\BAR"@HOSTNAME>
and then I retrieve it from GreenMail's IMAP server, JavaMail's ENVELOPE class, which is reading the response, throws
javax.mail.MessagingException: Failed to load IMAP Envelope
JavaMail generated the legal quoted Message-ID when calling MimeMessage.saveChanges() prior to sending it.
The IMAP RFC3501 (section 9) says that the envelope's message-id will either be a quoted string, or a literal surround by braces. GreenMail is correctly quoting around the entire Message-ID. But in doing so, all quotes inside the Message-ID must be escaped prior to sending the response. Since these quotes are not escaped in GreenMail's envelope response data, the JavaMail reading code (ENVELOPE.java) rejects the invalid response.
Issue migrated to https://github.com/greenmail-mail-test/greenmail/issues/4.
Fixed in GreenMail 1.4 .