Added Gmail OAuth

Closes #17
This commit is contained in:
M66B
2018-08-27 14:31:45 +00:00
parent 9ff3718561
commit bc30dee6a1
18 changed files with 1058 additions and 45 deletions

View File

@@ -57,7 +57,7 @@ public class MessageHelper {
private MimeMessage imessage;
private String raw = null;
static Properties getSessionProperties() {
static Properties getSessionProperties(int auth_type) {
Properties props = new Properties();
// https://javaee.github.io/javamail/docs/api/com/sun/mail/imap/package-summary.html#properties
@@ -97,6 +97,12 @@ public class MessageHelper {
props.put("mail.mime.address.strict", "false");
props.put("mail.mime.decodetext.strict", "false");
// https://javaee.github.io/javamail/OAuth2
if (auth_type == Helper.AUTH_TYPE_GMAIL) {
props.put("mail.imaps.auth.mechanisms", "XOAUTH2");
props.put("mail.smtps.auth.mechanisms", "XOAUTH2");
}
return props;
}