One cannot create a File object from a URL. You need to open a URLConnection to access the content of a URL.
Joined: Oct 25, 2006
I was about to give that a try before posting my issue before. But your reply confirmed to go ahead. thanks a lot.
I have another problem now. Now i am successfully able to send the mail with attachment.
But the problem is if there is an invalid address, I am not able to catch it. mail is sent to valid addresses but i am receiving a mail directly from system administrator about the failure to send mail to invalid addresses.
And I do not see any exception in my log
Email is a "fire and forget" protocol. If you are able to open a connection to the mail server then you will only get an error if the syntax of the email address is faulty. If the syntax is correct but the address does not exist then you will not know until later when the server sends you an non-delivery message. This is nothing you can do about this. For security reasons, some servers never send a non-delivery message.
Joined: Oct 25, 2006
Thanks a lot for your reply.
I was previously using commons apache mail to send the mail. If there is any invalid address, the entire send is failing for even valid address. Is javamail api the only option for partial sends or can we tweak the commons mail settings. I had to rewrite my entire application to enable partial sends.
jyothi nalam wrote:I was previously using commons apache mail to send the mail. If there is any invalid address, the entire send is failing for even valid address.
I know little about Apache mail but this cannot be the whole story. An invalid syntax of an email address is detectable by the client software. A domain name that does not exist is detectable by the client server. But if the recipient at some valid domain does not exist then it is only immediately detectable of the outgoing server (SMTP ?) rejects it immediately; it is my experience that this does not normally happen since the server will place the emails in a queue and then return.