Search code examples
jakarta-mailjavax.activation

SMTP error code : 551


com.sun.mail.smtp.SMTPSendFailedException: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail.

I am getting the error above when I integrate with the my Java Application running on a Tomcat server

Sending successfully if I use the same properties in separate class with main and run as java application

Why I am not getting this? Thank you in advance.


Solution

  • Finally got answer
    Here we go: before it was like
    `Properties props = new Properties();
    props.put("mail.smtp.host", "webmail.technobbyte.com");
    props.put("mail.smtp.port", "25");
    props.put("mail.smtp.starttls.enable", true);
    props.put("mail.smtp.auth", true);`
    
    
    now i changed to:
    `Properties props = new Properties();
    props.setProperty("mail.smtp.host", "webmail.technobbyte.com");
    props.setProperty("mail.smtp.port", "25");
    props.setProperty("mail.smtp.starttls.enable", "true");
    props.setProperty("mail.smtp.auth", "true");`