Skip to content

Instantly share code, notes, and snippets.

@ethanhinson
Created December 15, 2017 19:29
Show Gist options
  • Save ethanhinson/1906e41b23dcfaa38f147dbb176b49fa to your computer and use it in GitHub Desktop.
Save ethanhinson/1906e41b23dcfaa38f147dbb176b49fa to your computer and use it in GitHub Desktop.
Simple Smart Email
/*
Add a dependancy via Gradle:
dependencies {
compile 'createsend:createsend-java:5.1.0'
}
Or Maven:
<dependency>
<groupid>createsend-java</groupid>
<artifactid>createsend-java</artifactid>
<version>5.1.0</version>
</dependency>
*/
// Authenticate with API Key
ApiKeyAuthenticationDetails auth = new ApiKeyAuthenticationDetails("ad69e29d4f7417b74b776d5173414e40a1680ae27da9be6f");
UUID smartEmailID = UUID.fromString("8b7920f5-ef89-489e-a328-2ad90f4b300f");
String toAddress = "Bluetent <ethan@bluetent.com>";
SmartEmail smartEmail = new SmartEmail(auth);
SmartEmailRequest smartEmailRequest = new SmartEmailRequest(smartEmailID, toAddress);
// Add mail merge variables
smartEmailRequest.addData("guest_name", "guest_nameTestValue");
// Send the smart email
smartEmail.send(smartEmailRequest);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment