I'm trying to send emails with attachments through Amazon SES for Android. The documentation suggests that I send a Raw Email but this documenation was for the AWS SDK for Java, but it does not work with the Android AWS SDK. I get this error message when I try to send a Raw Email with the Android AWS SDK:
com.amazonaws.AmazonServiceException: Could not find operation SendRawEmail for version 2010-12-01
I made the message using MimeMessage, which is set to variable message in this code:
public void sendEmail() {
try {
AWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY);
AmazonSimpleEmailServiceClient sesClient = new AmazonSimpleEmailServiceClient(credentials);
sesClient.setEndpoint("https://sns.us-west-2.amazonaws.com");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
message.writeTo(outputStream);
RawMessage rawMessage =
new RawMessage(ByteBuffer.wrap(outputStream.toByteArray()));
SendRawEmailRequest rawEmailRequest =
new SendRawEmailRequest(rawMessage);
sesClient.sendRawEmail(rawEmailRequest);
System.out.println("Email sent!");
} catch (Exception ex) {
System.out.println("Email Failed");
System.err.println("Error message: " + ex.getMessage());
ex.printStackTrace();
}