• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Mail Problem !!!

 
Jack Daniel
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ebody,

you guys have to help me on this...

Well, i am working on a project which requires some sending of e-mails;
I am using websphere app server.

My program is always throwing an Exception saying:

java.net.UnknownHostException: serverName
[10/28/04 12:35:52:040 UTC] ef226ca9 SystemErr R Messaging exception: Sending failed;
nested exception is:
javax.mail.MessagingException: Unknown SMTP host: serverName;
nested exception is:
java.net.UnknownHostException: serverName

and this is happening at


any solutions on how to sort this problem??

and my other question would be, to get an instance of Session, the code would be



i want to concentrate more on :
p.put("mail.smtp.host", ip addr);

how is this different from
p.put("mail.host", ip addr); and p.put("ip addr", "MAIL_SMTP_HOST");

because sometimes i see these put to the Properties.
I mean which to consider? or it really does not matter what you put in Properties??

Thanks for your help..
 
Ash Tengshe
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is comprehensive list of properties that you can set for JavaMail to work.
The property you are referring to



here, host is a reference variable that is just a String that contains the address of the host (eg. "mailserver.myCompany.com")
You need to find out what value works for you, whats your email server? etc. and set that value.

Thanks,
Ashish
 
raghavendra gb
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi prashant Kakani,

Properties p = System.getProperties();

p.put("mail.smtp.host", ip addr);
p.put("mail.user", _mailuser);

change the above code to:

Properties p = System.getProperties();

p.put("mail.smtp.localhost", ip addr);
p.put("mail.user", _mailuser);

This code will work.

bye
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!