![]() IMAP by responding like a standard compliant POP3 or IMAP server. Again GreenMail can be used for system or unit testing an application needing to use POP3 or.See examplesįor hints on how to use GreenMail without the final GreenMailRule greenMail = new void testSend() throws MessagingException subject", "some body") // - Place your sending code here insteadĪssertEquals("some body", greenMail.getReceivedMessages().getContent()) The example below is using the GreenMail JUnit rule.Alternatively you can use a local client like Thunderbird. Note that retrieval of emails can be made with a simple java method or through a provided.To wait for messages to arrive, retrieve, verify, and modify messages. GreenMail is an excellent choice for unit testing code that needs to send email with a.Messages can easily beĮxtracted, verified and modified. It to be used in real life applications and real test cases. GreenMail responds like a regular SMTP server but does not GreenMail is useful in the following scenarios: Test Your Sending Code Jakarta Mail 2.0.x (jakarta.mail package prefix change).Provides flexible standalone run options such as.Embeds in JUnit test for integration testing.Prevents accidental email leaking to real mail servers (non-forwarding / sand-boxed).Supports SMTP, POP3 and IMAP including TLS/SSL.Typical use cases include mail integration testing or lightweight sand boxed mail server for GreenMail is an open source, intuitive and easy-to-use test suite of email servers for testing purposes. Sending/retrieving code Testing using Spring framework Deployments Run as a standalone Java process Run as a docker image Deploy as a webapp (WAR) Features API FAQ Download 2.0.0 (latest stable, JavaMail 2.0, JDK 8) 1.6.14 (maintenance, JDK 8) 1.5.14 (JDK 8) 1.5.11 (JDK 7) 1.4.1 1.3.1b Older versions ![]() ![]() About Intro Scenarios Implementation Source code Links and resources Thanks Examples Using JUnit4 rule based setup Using JUnit5 extension Testing your sending code (simple) Testing your sending code (detecting available port) Testing your sending code (advanced) Testing your retrieving code Testing using plain JavaMail for
0 Comments
Leave a Reply. |