Forums Register Login

Exception in sending a mail

+Pie Number of slices to send: Send
Hi,

I' am trying to send a mail and there is a messaging exception being raised at the Transport class.
I' am using the following code to send a mail.


There is a messaging ezception thrown as it reaches the line where I' am passing the message. The message ia html content sent as an array of bytes used in a different application.
The exception thrown is as follows:

A messaging excepttion is thrown at Transport.send(message).
Can you help me resolve the issue. I need to resolve this immediately.

Thanks and regards,
Komal
+Pie Number of slices to send: Send
Hi,

I' am not able to connect to the smtp server. I' am running the MailSender class as a standalone application in which I have included the code above. Now I have tried including transport.connect() where it is throwing an exception.
The exception in the standalone code is as follows:


javax.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1090)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:986)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:197)
at javax.mail.Service.connect(Service.java:255)
at javax.mail.Service.connect(Service.java:134)
at javax.mail.Service.connect(Service.java:86)
at com.sun.mail.smtp.SMTPTransport.connect(SMTPTransport.java:104)
at com.tanla.lms.MailSender.sendMail(MailSender.java:116)
at com.tanla.lms.MailSender.main(MailSender.java:281)



The exception is thrown in the line transport.connect()
Should I use SMTPtransport instead of Transport? I have o fix this.
I had never worked on javax.mail earlier. Now I dont have a clue whats creating the problem.
I would be glad if you can help identify where the problem is and rectify my code.
Thanks in advance.

regards,
Komal

Alas, poor Yorick, he knew this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 7203 times.
Similar Threads
Error while sending a mail using javaMail - reg.
Could not connect to SMTP host: smtp.bizmail.yahoo.com, port: 25
Need some help me java mail-smtp
Problem regarding JavaMail
how to send mail using gmail server
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:33:50.