@@ -17,10 +17,9 @@ public class DemoAppBase {
1717
1818 // if you have 2-factor login turned on, you need to generate a once-per app password:
1919 // https://security.google.com/settings/security/apppasswords
20- private static final String YOUR_GMAIL_PASSWORD = "<your password>" ;
21-
22- // getting this token requires a few steps, listed here: https://github.com/bbottema/simple-java-mail/issues/421#issuecomment-1371010959
23- private static final String YOUR_OAUTH2_TOKEN = "<your oauth2 token>" ;
20+ // if you use OAUTH2 (like in the OAuth2DemoApp.java), then getting this token requires a few steps, listed here:
21+ // https://github.com/bbottema/simple-java-mail/issues/421#issuecomment-1371010959
22+ static final String YOUR_GMAIL_PASSWORD = "<your password or oauth2 token>" ;
2423
2524 /**
2625 * If you just want to see what email is being sent, just set this to true. It won't actually connect to an SMTP server then.
@@ -37,17 +36,15 @@ public class DemoAppBase {
3736 }
3837 }
3938
40- static final MailerRegularBuilder <?> mailerSMTPBuilder = buildMailer ("smtp.gmail.com" , 25 , YOUR_GMAIL_ADDRESS , YOUR_GMAIL_PASSWORD , null , TransportStrategy .SMTP );
41- static final MailerRegularBuilder <?> mailerTLSBuilder = buildMailer ("smtp.gmail.com" , 587 , YOUR_GMAIL_ADDRESS , YOUR_GMAIL_PASSWORD , null , TransportStrategy .SMTP_TLS );
42- static final MailerRegularBuilder <?> mailerSSLBuilder = buildMailer ("smtp.gmail.com" , 465 , YOUR_GMAIL_ADDRESS , YOUR_GMAIL_PASSWORD , null , TransportStrategy .SMTPS );
43- static final MailerRegularBuilder <?> mailerOAuth2Builder = buildMailer ("smtp.gmail.com" , 587 , YOUR_GMAIL_ADDRESS , null , YOUR_OAUTH2_TOKEN , TransportStrategy .SMTP_OAUTH2 );
44-
39+ static final MailerRegularBuilder <?> mailerSMTPBuilder = buildMailer ("smtp.gmail.com" , 25 , YOUR_GMAIL_ADDRESS , YOUR_GMAIL_PASSWORD , TransportStrategy .SMTP );
40+ static final MailerRegularBuilder <?> mailerTLSBuilder = buildMailer ("smtp.gmail.com" , 587 , YOUR_GMAIL_ADDRESS , YOUR_GMAIL_PASSWORD , TransportStrategy .SMTP_TLS );
41+ static final MailerRegularBuilder <?> mailerSSLBuilder = buildMailer ("smtp.gmail.com" , 465 , YOUR_GMAIL_ADDRESS , YOUR_GMAIL_PASSWORD , TransportStrategy .SMTPS );
42+
4543 @ SuppressWarnings ("SameParameterValue" )
46- private static MailerRegularBuilder <?> buildMailer (String host , int port , String gMailAddress , String gMailPassword , String oauth2token , TransportStrategy strategy ) {
44+ static MailerRegularBuilder <?> buildMailer (String host , int port , String gMailAddress , String gMailPassword , TransportStrategy strategy ) {
4745 return ImplLoader .loadMailerBuilder ()
48- .withSMTPServer (host , port , gMailAddress )
46+ .withSMTPServer (host , port , gMailAddress , gMailPassword )
4947 .withSMTPServerPassword (gMailPassword )
50- .withSMTPOAuth2Token (oauth2token )
5148 .withTransportStrategy (strategy )
5249 .withTransportModeLoggingOnly (LOGGING_MODE )
5350 .clearProxy ();
0 commit comments