Mohammad Reza Kargar
Mohammad Reza Kargar

Reputation: 219

javax.mail.MessagingException: 501 5.5.1 HELO/EHLO requires domain address

My web app (java/spring) application in localhost sends email successfully but when i deploy it on host i got following error:

javax.mail.MessagingException: 501 5.5.1 HELO/EHLO requires domain address

I use java mail library.

web server: tomcat 7

thanks.

Upvotes: 1

Views: 7279

Answers (1)

Mohammad Reza Kargar
Mohammad Reza Kargar

Reputation: 219

after a lot of googling i found the workaround below:

http://www.coderanch.com/t/271097/java/java/JavaMail-Exception-HELO-requires-domain

we should add the following props when creating the session to bypass "send hello first" error:

props.put("mail.smtp.auth", "true")
props.put("mail.smtp.transport.protocol", "smtp"); 
props.put("mail.smtp.starttls.enable", "true"); 
props.put("mail.smtp.localhost", "127.0.0.1");

but it is a workaround and the root cause is not found.

Upvotes: 4

Related Questions