javax.mail.AuthenticationFailedException: 535 5.7.3 Authentication unsuccessful

后端 未结 5 1166
野的像风
野的像风 2021-01-18 07:29

I am sending e email using an SMTP error . I am getting Authentication unsuccessful. The username and password are correct. Am I doing something wrong.

The error log

相关标签:
5条回答
  • 2021-01-18 07:41

    Same issue resolve by enabling IMAP of the sender email account in Exchange Control Panel (ECP) of outlook mail admin.

    0 讨论(0)
  • 2021-01-18 07:44

    Go to your Microsoft admin account and turn off the multi-factor authentication.

    By default it is enabled. Once you disable the multi-factor authentication then it works fine for me.

    0 讨论(0)
  • 2021-01-18 07:48

    It looks like the problem in how you do the session part...

    try doing this:

    private Properties emailPorperties;
    

    ... ...

        emailPorperties = new Properties();
        emailPorperties.put("mail.smtp.host", "your host");
        emailPorperties.put("mail.smtp.socketFactory.port", "your port");
        emailPorperties.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
        emailPorperties.put("mail.smtp.auth", "true");
        emailPorperties.put("mail.smtp.port", "your port");
        emailPorperties.put("mail.smtp.ssl.enable", "true");
        emailSession = Session.getInstance(emailPorperties, new Authenticator() {
    
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    System.out.println("Authenticating");
                    return new PasswordAuthentication(USER_NAME, PASSWORD);
                }
    
            });
    
    0 讨论(0)
  • 2021-01-18 08:01

    Hello i've got the same issue in the past. So to solve it i have to connect on the webmail of my outlook or exchage and i noticed that these connexions were stopped by the server so inside i confirm that these transactions was mine. So u have also to do it usually every 2 month in my case.

    The problem is not in the code. The problem occurs because something is wrong with the configuration of the mailboxes I believe.

    0 讨论(0)
  • 2021-01-18 08:04

    Had the same issue. It's an MS Exchange error that you receive. You are probably not allowed to use your email to send an email via a relay. The administrator of the Exchange server needs to give the rights to do that.

    It has nothing to do with a configuration problem on the Java side.

    0 讨论(0)
提交回复
热议问题