Last active
May 13, 2018 08:09
-
-
Save LeoHeo/7742e280c5b013a9a334b562c18d3b32 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @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