Videos
Check out our tutorial video series.
Send and Receive Emails Easily in Java and Kotlin Without a Mail Server Using the Free MailSlurp SDK - Try It Now!
Create and manage real email addresses in Java, Kotlin and more using the free MailSlurp SDK.
Java and it's related JVM cousins provide a wonderful programming experience. SMTP servers on the other hand do not! That's why we made MailSlurp: as Java and Kotlin developers ourselves we wanted a better way to send and receive emails in JUnit tests.
To skip right to the code see the Java Method Documentation or JavaDocs.
MailSlurp has a simple REST API for creating email addresses. These inboxes can then be used to send and receive emails and attachments without the need for a MailServer.
An official Java SDK is available on Maven Central for free with an MIT license. You can use Maven, SBT, Gradle or any build agent you wish.
To use MailSlurp with maven add the dependencies to your project:
To setup MailSlurp with Gradle simple include the following:
To start using the MailSlurp API you need a free API Key. Get one by signing up.
Then import and configure the SDK like so:
You can list your email addresses in a paginated format:
Now that we know how to get started let's try something more complicated. We can create two email addresses and send an email with an attachment between them. Then we can wait for the email to arrive then download the sent attachment. This can be useful in many test environments.
Sending and receive emails in Java, Kotlin, Groovy, Scala, Clojure and more is easy with MailSlurp. It is free for personal use and is built on top of scalable cloud infrastructure. To get started see the Java examples page or the official developer docs.
Check out our tutorial video series.
Email and SMS guides for automation and testing.
View github project code for multiple languages.
Latest posts from the MailSlurp team.
Test, build, and automate messaging with a free MailSlurp account.