• Post Reply Bookmark Topic Watch Topic
  • New Topic

Not able to send mail using SMTPTransport

 
Naresh Talluri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have a small problem with sending mail using java mail API.
Iam trying to send Using SMTPTransport class sendMessage(message, args) method.
Iam not able to connect to server.it is showing
here is my code:


here i'll get session object , message object perfectly.

I tried to use , with the same host name as "smtp.a-cti.com", it is working fine and i can able to connect ot server.
but if i used SMTPTransport iam not able to connect.
can you please let me know if i missed our anywhere.

Appriciate if you have any solutions.
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naresh Talluri wrote:Iam not able to connect to server.

How do you know? You haven't even tried!

There are three connect() messages declared in Service, which is the super class of Transport which is the super class of SMTPTransport (or at least I'm guessing it is - there is no public class SMTPTransport in Java EE 5's API). You should call one of those before trying to do anything with the transport. And don't forget to close() it afterwards, preferably in a try-finally block:
 
Naresh Talluri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thank you , now it is working fine.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!