You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows you to test both the sending side and receiving side.
46
46
All you need to do is to drop the JAR in the classpath during the test.
47
47
48
+
== Enforcing usage in tests
49
+
50
+
This library works thanks to the https://jakarta.ee/specifications/mail/2.1/apidocs/jakarta.mail/jakarta/mail/session#getProvider(java.lang.String)[JavaMail API] which allows to use different providers implementation to handle actual email sending.
51
+
52
+
To ensure it's used in your tests, you need to define the following Java system properties:
53
+
54
+
`mail.smtp.class`:: set to `org.jvnet.mock_javamail.MockTransport`
55
+
`mail.pop3.class`:: set to `org.jvnet.mock_javamail.MockStore`
56
+
`mail.imap.class`:: set to `org.jvnet.mock_javamail.MockStore`
57
+
58
+
This can be done either manually or via a configuration in your test runner.
59
+
60
+
=== Maven
61
+
62
+
For example, with Maven this can be done with the following configuration:
0 commit comments