-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from IoTeaTime/fix/127-ses
fix: 이메일 인증 SES로 구현부 변경
- Loading branch information
Showing
7 changed files
with
90 additions
and
132 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
118 changes: 0 additions & 118 deletions
118
src/main/java/org/ioteatime/meonghanyangserver/clients/google/GoogleMailClient.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
src/main/java/org/ioteatime/meonghanyangserver/clients/ses/SesClient.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.ioteatime.meonghanyangserver.clients.ses; | ||
|
||
import com.amazonaws.services.simpleemail.AmazonSimpleEmailService; | ||
import com.amazonaws.services.simpleemail.model.*; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class SesClient { | ||
@Value("${google.official-gmail}") | ||
private String officialGmail; | ||
|
||
private final AmazonSimpleEmailService emailService; | ||
|
||
public void sendEmail(String email, String subject, String body) { | ||
final String FROM = officialGmail; | ||
final String TO = email; | ||
final String SUBJECT = subject; | ||
final String HTMLBODY = body; | ||
|
||
SendEmailRequest request = | ||
new SendEmailRequest() | ||
.withDestination(new Destination().withToAddresses(TO)) | ||
.withMessage( | ||
new Message() | ||
.withBody( | ||
new Body() | ||
.withHtml( | ||
new Content() | ||
.withCharset("UTF-8") | ||
.withData(HTMLBODY))) | ||
.withSubject( | ||
new Content() | ||
.withCharset("UTF-8") | ||
.withData(SUBJECT))) | ||
.withSource(FROM); | ||
emailService.verifyEmailAddress(new VerifyEmailAddressRequest().withEmailAddress(email)); | ||
emailService.sendEmail(request); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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