Java
Official Mailgun Java SDKInstallation
To run the SDK, you will need Java 1.8+. The recommended way to use the Mailgun Java SDK in your project:
Add the following to your pom.xml
:
<dependencies>
...
<dependency>
<groupId>com.mailgun</groupId>
<artifactId>mailgun-java</artifactId>
<version>1.1.x</version>
</dependency>
...
</dependencies>
Gradle Groovy DSL
implementation 'com.mailgun:mailgun-java:1.1.3'
Usage
Here's a simple example on how to send an email. As always, please consult the repository readme for full details.
Message message = Message.builder()
.from(EMAIL_FROM)
.to(USER_EMAIL)
.subject(SUBJECT)
.text(TEXT)
.build();
MessageResponse messageResponse = mailgunMessagesApi.sendMessage(DOMAIN, message);