• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to send a mail to different email id

 
Sanjeev Janardhanan
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have caught up with an issue.

I have tried the below listed code to send mail. The issue is

eg: 1) from :abc@sam.com To : acd@sam.com , it works fine.
2) from :abc@sam.com To : acd@don.com, it leads to an issue.

issue:

javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for sanjeev.janardhanan@gmail.com

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1607)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:887)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:142)
at com.servion.FileUpload.doPost(FileUpload.java:235)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 550 5.7.1 Unable to relay for sanjeev.janardhanan@gmail.com

at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1458)


Code:

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch Sanjeev

There is a JavaMail FAQ in oracle
http://www.oracle.com/technetwork/java/faq-135477.html

by the way: Please use code tag while posting your code.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seetharaman Venkatasamy wrote: . . . Please use code tag while posting your code.
Since he's new, I'll add them and he can see how much better the post looks
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Since he's new, I'll add them and he can see how much better the post looks

Great!
 
Lester Burnham
Rancher
Posts: 1337
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These days you will almost always have to use authentication (info about which is in the FAQ mentioned above). Just about the only exceptions are if you either a) use a mail server you have set up yourself without authentication, or b) send mail within a company network - that's case 1 you mention.
 
Sanjeev Janardhanan
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for the good reply and correction made.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic