Wil*_*ill 14 smtp jakarta-mail office365
我在配置SMTP设置以javax.mail (1.4.4)通过Office365 使用发送邮件时遇到问题,所以我想我会在这里为其他人发布这些属性.
Wil*_*ill 14
使用Office365 smtp详细信息如下:
Run Code Online (Sandbox Code Playgroud)private static Properties props; private static Session session; static { props = new Properties(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.port", "587"); props.put("mail.smtp.host", "m.outlook.com"); props.put("mail.smtp.auth", "true"); session = Session.getInstance(props, new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("office365 email address", "office365 password"); } }); }
使用spring-boot,您只需将其添加到您的application.properties:
spring.mail.host = smtp.office365.com
spring.mail.username = mathieu.pousse@headquarter.com
spring.mail.password = s3cr3t
spring.mail.port = 587
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.starttls.enable = true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
38218 次 |
| 最近记录: |