San
San

Reputation: 786

AWSSDK V2 Java SES sending email - AmazonSimpleEmailService cannot be resolved

I am trying to integrate aws SES SDK v2 to send emails in the application and this is my initial project with aws sdk. However, I am following below example from the docs but the main classes are not able to resolve even though I have added proper dependencies in gradle.

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-sdk-java.html

Gradle dependencies added: implementation platform('software.amazon.awssdk:bom:2.10.36') implementation group: 'software.amazon.awssdk', name: 'ses', version: '2.10.36'

Is there any other dependencies I am missing? I see that intellij has all dependent jars in the project for the above. But still no luck in finding the jars for the below classes.

AmazonSimpleEmailService AmazonSimpleEmailServiceClientBuilder

Upvotes: 2

Views: 3480

Answers (1)

San
San

Reputation: 786

Apparently, there are quite few changes in client classes between 1.x to 2.x versions. Both of below classes are removed from sdk.

AmazonSimpleEmailService
AmazonSimpleEmailServiceClientBuilder

In place of them, SesClient and SesClientBuilder are provided which works fine.

https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md

Here is sample code:

SesClient client = SesClient.builder()
  .region(Region.of(emailRegion))
  .build();
SendEmailRequest request = SendEmailRequest.builder()
  .source(fromAddress)
  .destination(destination)
  .message(message)
  .build();
client.sendEmail(request);

Upvotes: 3

Related Questions