• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Problem with SMTPAppender

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello !

Since I'm really getting out of patience and time, I beg for your help !

I'm sending email via SMTPAppender.
Everything works fine when the application runs on my laptop. Emails are sent and received.

When I put it on a *nux box, with of course, everything exaclty configured the same, emails are not send anymore !
I get a
501 Usage HELO hostname
exception.

The smtp server is reachable, of course. That's really the EHLO command that fail...

Same code, same configuration, same jars, aso...

But something is getting wrong on the linux box !

I ran into every existing doc I found on javamail, log4j and so, but didn't found an answer to that issue...

Can anyone give some help ???

Thanks in advance !

A (mad) J2EE developer.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First google hit on 501 Usage HELO hostname exception log4j:

Have you gotten the exception javax.mail.MessagingException: 501 5.0.0 HELO requires domain addressavax.mail.MessagingException: 501 5.0.0 HELO requires domain address? Jason Falkner provides a solution in his blog entry A stupid user trick for goggle to cache. He tells you "The problem is as simple as translating your computer's IP address to a name. Just add the appropriate entry in /etc/hosts that converts your computer's IP to its hostname."

Did you try that?



This one has basically same thing, mentions linux:

Java's platform independence is great, except when it...er, the user doesn't work. Take for instance JavaMail. The API is great. Who doesn't love the ability to send e-mail, and few other simple programming tricks can make your boss ooh and ah like a customized e-mail.

If you are using linux and get the following, very-google-cachable exception.

javax.mail.MessagingException: 501 5.0.0 HELO requires domain address

at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1189)
at com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:732)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:293)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
at org.proteomecommons.EmailTools.main(EmailTools.java:68)
You'd be out of luck. Until now that is. The problem is as simple as translating your computer's IP address to a name. Just add the appropriate entry in /etc/hosts that converts your computer's IP to its hostname.
 
Micheline Dax
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well...

To fix the ideas : the application is deployed on the machine
networkName (IP : 10.0.0.1)


The error I get when I try to send mail with log4j :
----------------------------------------------------------------------------
log4j:ERROR Error occured while sending e-mail notification.
javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 501 Syntax: HELO hostname
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
----------------------------------------------------------------------------


The /etc/hosts file contains (excerpt) :
------------------------------------------------------------------------
127.0.0.1 localhost
10.0.0.1 networkName.mycompany.priv.com networkName.mycompany.com networkName
------------------------------------------------------------------------


So why does this damn Transporter doesn't send the hostname whe EHLO'ing the smtp server ???
 
Micheline Dax
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok well !

After some more digging... I'm making some progress !

http://java.sun.com/products/javamail/FAQ.html#helo

Then I trid :
InetAddress.getLocalHost()

that gives me :
java.net.UnknownHostException: networkName: networkName


Considering my /etc/hosts file, that really makes me wonder...
what did I missed ?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i get the same problem you mentioned aboved,and i solve it by the blow method.
i found the main reason is your hostname contain some special characters,for instance ,your hostname is 'bj30/' ,that's will occur and synx err,so,i rename my hostname ,and then ,that go ok
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A workaround that solved it for me : https://coderanch.com/t/271097/Other-JSE-JEE-APIs/java/JavaMail-Exception-HELO-requires-domain#2116078
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"T totheC", please check your private messages for an important administrative matter.
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic