Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sun Jan 31, 2010 8:48 am 
Offline
Newbie

Joined: Sun Jan 31, 2010 8:34 am
Posts: 2
Website: http://www.quarksystems.eu
WLM: underdom@hotmail.com
Location: Serbia, Koceljeva
Hi. I have just installed the Exim MTA on Debian 5. After installation I have tested it by typing in shell :
echo "This is a test." | mail -s Testing someone@somedomain.com
, where someone@somedomain.com is my mail.
And it was successful sending of email, to specified address.
However, when I try to send an email from my application, because my application does that, I try to specify my smtp server as 'localhost' in my code, using java mail, like this :

Code:
   properties = new Properties( );
   properties.put("mail.host", 'localhost');
   session = Session.getInstance(properties, null);


..etc...

When I do so I get an exception :

Code:
javax.mail.MessagingException: 501 Syntactically invalid HELO argument(s)

at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1634)
at com.sun.mail.smtp.SMTPTransport.helo(SMTPTransport.java:1070)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:458)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
...more stack here



However, I try to specify mail server as a 'mail.quarksystems.eu', where quarksystems.eu is my domain, I got a following error :

Code:
javax.mail.MessagingException: Could not connect to SMTP host: quarksystems.eu, port: 25;
nested exception is:
java.net.ConnectException: Connection refused
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1545)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:453)
at javax.mail.Service.connect(Service.java:291)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
...more...



So, how can I find out, what is the name of my server, in order to send a mail, or where to configure it, or do I event need to specify that property?
Thanks in advance


Top
   
 Post subject:
PostPosted: Sun Jan 31, 2010 10:01 am 
Offline
Newbie

Joined: Sun Jan 31, 2010 8:34 am
Posts: 2
Website: http://www.quarksystems.eu
WLM: underdom@hotmail.com
Location: Serbia, Koceljeva
It will be my pleasure, to inform (and save further rookies of Linoide hours, and hours -at least I have spent about 10 hours to figure out a problem), about this exception issue, and how to fix it, especially if they are newbies in Linode, as I am.
As you guess, the solution is as stupid as it was expected.
First, you SMTP server, during Session configuration (if u use JavaMail API) is "localhost".
Second, [u]set your hostname to appointing your domain :
example :

echo "rookiedebugger.com" > /etc/hostname
hostname -F /etc/hostname

Reboot your Linode and, finally send an email:)


Top
   
 Post subject:
PostPosted: Mon Feb 01, 2010 7:20 am 
Offline
Senior Member

Joined: Wed Oct 20, 2004 8:55 am
Posts: 120
afrodom wrote:
echo "rookiedebugger.com" > /etc/hostname
hostname -F /etc/hostname



Except that /etc/hostname should be the name of your machine, like server, or www, or joeblogs or some other single name:

Now set the hostname of the machine. We'll be calling it "server":

echo server > /etc/hostname
hostname -F /etc/hostname

Then logout and log back in for the new hostname to take effect

Setup the servers host name resolution
Edit /etc/hosts

127.0.0.1 localhost.localdomain localhost
10.10.10.10 server.example.com server


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group