Skip to content

Instantly share code, notes, and snippets.

@kalvian1060
Created May 23, 2017 08:04
Show Gist options
  • Save kalvian1060/b584c62e7924a49de25865a584cb37f5 to your computer and use it in GitHub Desktop.
Save kalvian1060/b584c62e7924a49de25865a584cb37f5 to your computer and use it in GitHub Desktop.
public static ClientResponse SendEmailGun(String to) {
WebResource webresource = null;
MultivaluedMapImpl formData = new MultivaluedMapImpl();
try {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("api", MAILGUN_API_KEY));
webresource = client.resource(MAILGUN_HOST + "/messages");
formData.add("from", "Excited User <[email protected]> ");
formData.add("to", to);
formData.add("subject", "Struk Belanja Anda");
formData.add("text", "Testing PIN ADMOB");
} catch (Exception e) {
e.printStackTrace();
}
return webresource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment