如何使用Android应用程序中的amazon Web服务发送邮件

时间:2016-11-22 12:45:14

标签: android email sendmail amazon-ses

我在amazon webservices中发现了一些从android应用程序发送邮件的信息。它包含以下代码。如何在我的应用程序中使用此代码。请帮助我。

    AWSCredentials credentials = new BasicAWSCredentials( PropertyLoader.getInstance().getAccessKey(), PropertyLoader.getInstance().getSecretKey() );
    AmazonSimpleEmailServiceClient sesClient = new AmazonSimpleEmailServiceClient(credentials);
    String subjectText = "Feedback from " + nameField.getText();
    Content subjectContent = new Content(subjectText);
    String bodyText = "Rating: " + ratingBar.getRating() + "\nComments\n" + commentsField.getText();
    Body messageBody = new Body(new Content(bodyText));
    Message feedbackMessage = new Message(subjectContent,messageBody);
    String email = PropertyLoader.getInstance().getVerifiedEmail();
    Destination destination = new Destination().withToAddresses(email);
    SendEmailRequest request = new SendEmailRequest(email,destination,feedbackMessage);
    SendEmailResult result = clientManager.ses().sendEmail(request);

0 个答案:

没有答案