Skip to content

Instantly share code, notes, and snippets.

@kibotu
Created August 5, 2015 18:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kibotu/5fb14d617122fdedb122 to your computer and use it in GitHub Desktop.
Save kibotu/5fb14d617122fdedb122 to your computer and use it in GitHub Desktop.
mandrill send message
private void sendMessage(@NotNull final String fromEmail, @NotNull final String fromName) {
final String apiKey = AppConfig.getValue(MANDRILLAPP_API_KEY);
final MandrillServiceFactory serviceFactory = new MandrillServiceFactory(apiKey, new GsonJsonHandler(new Gson()), new HttpComponentsHandler(new DefaultHttpClient()));
final Category.Messages messages = serviceFactory.getService(Category.Messages.class);
final Struct message = Struct.with("text", "" + feedbackMessage.getText().toString())
.set("to", StructArray.with(Struct.with("email", Localization.getString(R.string.kEmailTitle))))
.set("subject", Localization.getString(currentMode.resourceId))
.set("from_email", fromEmail)
.set("from_name", fromName);
final StructArray handle = messages.send(message, true, null, null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment