Prerequisites
To get the most out of this guide, you’ll need to:1. Install
2. Send emails using HTML
Main.java
3. Try it yourself
Java Examples
See the full source code.
Learn how to send your first email using the Emailr Java SDK.
implementation 'com.emailr:emailr-java:+'
import com.emailr.*;
public class Main {
public static void main(String[] args) {
Emailr emailr = new Emailr("em_xxxxxxxxx");
CreateEmailOptions params = CreateEmailOptions.builder()
.from("Acme <[email protected]>")
.to("[email protected]")
.subject("it works!")
.html("<strong>hello world</strong>")
.build();
try {
CreateEmailResponse data = emailr.emails().send(params);
System.out.println(data.getId());
} catch (EmailrException e) {
e.printStackTrace();
}
}
}