Tutorials
Email and SMS guides for automation and testing.
How to use Java SMTP client to send email with MailSlurp mail server on the JVM. Configure IMAP access or use SMTP.
Java provides battle-tested mail sending capabilities with the package. Using this library we can connect to SMTP mailboxes and send emails using the SMTP transport. To send emails from MailSlurp accounts we can use the MailSlurp Java library to create an inbox and get the username, password, port and host for SMTP access.
See the JavaDocs documentation for more information.
First let us install MailSlurp and the Java mail package using Maven.
Next we can create a new throw-away email inbox using MailSlurp. First we must set the API Key for the MailSlurp client.
To send an email using Javax Mail package first create an inbox then get the inbox access details from MailSlurp. Use the returned imap smtp access details to configure the mail properties.
For more email options with Java see the MailSlurp Java documentation and the examples repositories.
Email and SMS guides for automation and testing.
View github project code for multiple languages.
Latest posts from the MailSlurp team.
Try a free MailSlurp account.
Test, build, and automate messaging with a free MailSlurp account.