Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to set up emailing from a java web application hosted on a linux server (Cent OS) in apache.

Sendmail is working fine from the command line as root on localhost but when trying to send emails from the java web app (also on the same server from localhost) the following java exception is thrown.

501 5.0.0 HELO requires domain address

EDIT: I have read that some people have found this is due to an incorrect hosts entry currently the hosts file contains Centos-VPS localhost.localdomain localhost

and i'm not sure what the Centos-VPS bit at the start is for but this is a clients hosted server so don't really want to break stuff

EDIT see the RFC is helpful ...

501 Syntax error in parameters or arguments

Now I know what the problem is! (note the sarcasm people.)

share|improve this question
What does your Java web app send as HELO? It should be something like yourhost.yourdomain.com –  Janne Pikkarainen Jul 18 '11 at 7:17
it's configurable but have tried localhost and localhost.localdomain –  ealgestorm Jul 18 '11 at 7:23
And you are sure it really sends out those? Have you read the server mail log or observed the SMTP conversation in some other way? –  Janne Pikkarainen Jul 18 '11 at 7:25
Have you tried looking over the SMTP RFC yet? –  Ignacio Vazquez-Abrams Jul 18 '11 at 7:34
RFCs are very very helpful. They define the expected behavior.Your web application is not sending a correct HELO string. So you have to show us how is this application trying to connect to the server, and what it is sending together with the HELO string. –  adamo Jul 31 '11 at 14:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.