Created
August 5, 2015 18:21
-
-
Save kibotu/5fb14d617122fdedb122 to your computer and use it in GitHub Desktop.
mandrill send message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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