Nava
Nava

Reputation: 21

Springboot Email failing for Office365 SMTP account

I am using one of my email(office385) account created from my Godaddy domain. I am trying to send email from a springboot microservice using SMTP. I've enabled SMTP authentication in Godaddy email profile.

private static void godaddy(JavaMailSenderImpl mailSender) {
        mailSender.setHost("smtp.office365.com");
        mailSender.setPort(587);
        mailSender.setUsername("[email protected]");
        mailSender.setPassword("my-password");

        Properties javaMailProperties = new Properties();
        javaMailProperties.put("mail.smtp.starttls.enable", "true");
        javaMailProperties.put("mail.smtp.auth", "true");
        javaMailProperties.put("mail.transport.protocol", "smtp");
        javaMailProperties.put("mail.debug", "true");
        javaMailProperties.put("mail.smtp.ssl.enable", "false");
        javaMailProperties.put("mail.smtp.ssl.trust", "*");

        mailSender.setJavaMailProperties(javaMailProperties);
    }```
I am able to pass authentication but after that failiing with following error.

STARTTLS 220 2.0.0 SMTP server ready EHLO 192.168.1.72 250-LO4P265CA0073.outlook.office365.com Hello [86.145.143.97] 250-SIZE 157286400 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH LOGIN XOAUTH2 250-8BITMIME 250-BINARYMIME 250-CHUNKING 250 SMTPUTF8 DEBUG SMTP: Found extension "SIZE", arg "157286400" DEBUG SMTP: Found extension "PIPELINING", arg "" DEBUG SMTP: Found extension "DSN", arg "" DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg "" DEBUG SMTP: Found extension "AUTH", arg "LOGIN XOAUTH2" DEBUG SMTP: Found extension "8BITMIME", arg "" DEBUG SMTP: Found extension "BINARYMIME", arg "" DEBUG SMTP: Found extension "CHUNKING", arg "" DEBUG SMTP: Found extension "SMTPUTF8", arg "" DEBUG SMTP: protocolConnect login, host=smtp.office365.com, [email protected], password= DEBUG SMTP: Attempt to authenticate using mechanisms: LOGIN PLAIN DIGEST-MD5 NTLM XOAUTH2 DEBUG SMTP: Using mechanism LOGIN DEBUG SMTP: AUTH LOGIN command trace suppressed DEBUG SMTP: AUTH LOGIN succeeded DEBUG SMTP: use8bit false MAIL FROM:<my_laptop@[192.168.1.72]> 501 5.1.7 Invalid address DEBUG SMTP: got response code 501, with response: 501 5.1.7 Invalid address


Note: The email address is valid I can send/receive emails in outlook client. 

Upvotes: 0

Views: 37

Answers (0)

Related Questions