Registry / testing / mock-javamail

mock-javamail

JSON →
library1.8javamavenunverified

A mock implementation of the JavaMail API for testing email functionality without a real mail server.

<dependency> <groupId>org.jvnet.mock-javamail</groupId> <artifactId>mock-javamail</artifactId> <version>1.8</version> </dependency>
INSTALL
IMPORT
SIG · MOCK-JAVAMAIL
M
mock-javamail
testingjavav1.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Mailbox
org.jvnet.mock_javamail.Mailbox

Sends a mock email and checks the mailbox.

import org.jvnet.mock_javamail.Mailbox; import javax.mail.*; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class Test { public static void main(String[] args) throws Exception { Mailbox.clearAll(); Session session = Session.getDefaultInstance(new Properties()); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress("from@example.com")); msg.setRecipient(Message.RecipientType.TO, new InternetAddress("to@example.com")); msg.setSubject("Test"); msg.setText("Hello"); Transport.send(msg); System.out.println(Mailbox.get("to@example.com").size()); } }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.8latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
mock-javamail — mvn dependency:get mock-javamail · libregistry