Skip to content

Instantly share code, notes, and snippets.

@LeoHeo
Last active May 13, 2018 08:09
Show Gist options
  • Select an option

  • Save LeoHeo/7742e280c5b013a9a334b562c18d3b32 to your computer and use it in GitHub Desktop.

Select an option

Save LeoHeo/7742e280c5b013a9a334b562c18d3b32 to your computer and use it in GitHub Desktop.
@AllArgsConstructor
@Service
public class UserService {
private final AmazonSimpleEmailServiceAsync amazonSimpleEmailServiceAsync;
public void sendMail() {
final String FROM = "sender@example.com";
final String TO = "recipient@example.com";
final String SUBJECT = "Amazon SES test (AWS SDK for Java)";
final String HTMLBODY = "<h1>Amazon SES test (AWS SDK for Java)</h1>"
+ "<p>This email was sent with <a href='https://aws.amazon.com/ses/'>"
+ "Amazon SES</a> using the <a href='https://aws.amazon.com/sdk-for-java/'>"
+ "AWS SDK for Java</a>";
SendEmailRequest request = new SendEmailRequest()
.withDestination(
new Destination().withToAddresses(TO) // 받는 사람
)
.withMessage(new Message()
.withBody(new Body()
.withHtml(new Content()
.withCharset("UTF-8").withData(HTMLBODY)) // HTML 양식의 본문
.withSubject(new Content()
.withCharset("UTF-8").withData(SUBJECT))) // 제목
.withSource(FROM); // Verify된 Email
amazonSimpleEmailServiceAsync.sendEmailAsync(request);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment