• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JavaMail Error...

 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I am trying to send an e-mail using JavaMail API. But the thing is I can send it to my own Mail ID. But when I try my friends e-mail id i get an error message. I am putting his SMTP address and his e-mail address but i get an error message.



Could you guys let me where's it going wrong!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A quick lookup of SINCHNMBX001.TechMahindra.com indicates that the server can't be found (just like the error message says). Are you sure that's a publicly accessible mail server?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well its my company's exchange server! So it could be private! But is there any way to send overcome this issue? When i put in my exchange server in the code i get the error message:


Is there any solution to this issue?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An SMTP 550 message is caused by server configuation - someone has deliberately configured a server to prevent relaying messages from domains not supported by the server. If this is a server you administer you should be able to fix it.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately i don't administer the server. Is there a workaround?
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either make sure you only attempt to send emails from addresses the server is configured to allow or speak to your server administrator.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem here is more than likely to be authentication related. To send to an external email address you often need to authenticate your request.
When I hit similar problems a while ago, the way I authenticated (there may be other ways) was to add a property to the request.

You probably have something like:
Properties prop = new Properties();
prop.put("mail.smtp.host",host);

For authentication you also need to add:
prop.put("mail.smtp.auth","true");

Then when you use the Transport to send the message use the method:
Transport trans = session.getTransport(transportType);
...
trans.connect(host,user,password);
trans.sendMessage(msg,msg.getAllRecipients());


Another option for my org was to configure the email server to allow relay without authentication from selected hosts. Thats a question for your server admins.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That user name password thing made my code work! Thanks all!

Can this code be made to run on UNIX (Sun Solaris)? Or does it need a different concept! I was reading something about MAILX thing! Would that work?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My mail code was sending mails fine till an hour ago... When I ran the code with two or three addresses I see that....


And the mail is not sent! Could you please let me know what could be the problem?
reply
    Bookmark Topic Watch Topic
  • New Topic