Skip to content

Commit

Permalink
support send email with SMTPSSLTransport
Browse files Browse the repository at this point in the history
Signed-off-by: victorquan <[email protected]>
  • Loading branch information
dongqiaoershao committed Nov 28, 2023
1 parent 8fe3b1c commit 2c0fe61
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ public void send(Email email) {
String password = portalConfig.emailConfigPassword();

if (useSsl) {
t = (SMTPTransport) session.getTransport("smtp");
t.connect(host, user, password);
msg.saveChanges();
t.sendMessage(msg, msg.getAllRecipients());
logger.debug("email response: {}", t.getLastServerResponse());
} else {
tSsl = (SMTPSSLTransport) session.getTransport("smtps");
tSsl.connect(host, user, password);
msg.saveChanges();
tSsl.sendMessage(msg, msg.getAllRecipients());
logger.debug("email response: {}", tSsl.getLastServerResponse());

Check warning on line 76 in apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/defaultimpl/DefaultEmailService.java

View check run for this annotation

Codecov / codecov/patch

apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/defaultimpl/DefaultEmailService.java#L72-L76

Added lines #L72 - L76 were not covered by tests
} else {
t = (SMTPTransport) session.getTransport("smtp");
t.connect(host, user, password);
msg.saveChanges();
t.sendMessage(msg, msg.getAllRecipients());
logger.debug("email response: {}", t.getLastServerResponse());

Check warning on line 82 in apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/defaultimpl/DefaultEmailService.java

View check run for this annotation

Codecov / codecov/patch

apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/defaultimpl/DefaultEmailService.java#L78-L82

Added lines #L78 - L82 were not covered by tests
}
} catch (Exception e) {
logger.error("send email failed.", e);
Expand Down

0 comments on commit 2c0fe61

Please sign in to comment.