SendGrid SMTP API Java Bindings
This module lets you build SendGrid's SMTP API headers with simplicity.
![BuildStatus](https://maven-badges.herokuapp.com/maven-central/com.revinate/sendgrid-smtpapi-java/badge.svg)
Requirements
Java 1.6 and later.
Installation
Maven
Add this dependency to your project's POM:
<dependency>
<groupId>com.revinate</groupId>
<artifactId>sendgrid-smtpapi-java</artifactId>
<version>2.0.0</version>
</dependency>
Gradle
Add this dependency to your project's build script:
compile 'com.revinate:sendgrid-smtpapi-java:2.0.0'
Usage
import com.revinate.sendgrid.smtpapi.*;
SmtpApi header = new SmtpApiImpl();
String headerValue = header.toSmtpApiHeader();
If you need the unescaped JSON string:
String rawHeaderValue = header.toRawSmtpApiHeader();
header.addSmtpApiTo("email@email.com");
header.addSmtpApiTo("email@email.com", "Email User");
List<String> tos = header.getSmtpApiTos();
header.addValueToSubstitution("key", "value");
List<String> substitution = header.getSubstitution("key");
header.setUniqueArg("key", "value");
String arg = header.getUniqueArg("key");
header.addCategory("category");
List<String> categories = header.getCategories();
header.setSection("key", "section");
String section = header.getSection("key");
header.setSettingInFilter("filter", "setting", "value");
header.setSettingInFilter("filter", "setting", 1);
Map<String, Object> filter = header.getFilter("filter");
header.setAsmGroupId(1);
Integer groupId = header.getAsmGroupId();
header.setSendAt(1416427645);
Integer sendAt = header.getSendAt();
IP Pool
header.setIpPool("transactional");
String ipPool = header.getIpPool();
License
Licensed under the MIT License.