Google stop SMTP gateway 2022 May 30th

Viewed 202

Google stop SMTP gateway 2022 May 30th ? How to send mail using Gmail api with servlet(java), jsp

    Properties properties = new Properties();
    properties.put("mail.smtp.host", "smtp.gmail.com");
    properties.put("mail.smtp.port", "587");
    properties.put("mail.smtp.auth", "true");
    properties.put("mail.smtp.starttls.enable", "true");
    properties.put("mail.smtp.starttls.required", "true");
    properties.put("mail.smtp.ssl.protocols", "TLSv1.2");
    properties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    Session session = Session.getInstance(properties, new javax.mail.Authenticator() {
        protected PasswordAuthentication getPasswordAuthentication() {
            return new PasswordAuthentication(username, password);
        }
    });
1 Answers

you can do that by enabling the 2FA authent on your GMAIL account. Then go to : Google account -> security -> sign in to google -> application passwords Then you can generate one password for your application.

https://support.google.com/accounts/answer/185833

Related