on 09-01-2009 12:43 PM
Hi,
I am developing an application which uses javamail API to send a mail along with an attachment to the specified user.
I am able to successfully send the text message via mail.
But sending mails with attachments is not working for me.
I have checked all the content in SDN and google, but none of them are clear enough to solve my problem.
I am using the below code for attachment
DataSource fds = new FileDataSource("fileName"); //The path to the fie to be attached
mimeBodyPart_Attachment.setDataHandler(new DataHandler(fds));
mimeBodyPart_Attachment.setFileName("fds.getName()");
My Question is
What exactly should be the fileName here?
can it be just a path to any of the documents in my local desktop say for example, "D:\Documents and Settings\Arrivals.xls"?
or should I first store the file to be attached in the server and then give the path of the document in the server as fileName?
I tried both the ways, I am getting FileNotFoundException (The device is not ready).
Has anyone worked on attachments in java mail or faced this issue before?
Kindly let me know.
Regards,
Shilpa B.V
Hi
Please follow this [thread|http://www.jguru.com/faq/view.jsp?EID=30251] .
Best Regards
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Shilpa,
Refer to [this|http://www.jguru.com/faq/view.jsp?EID=30251] link. It mentions that you have to use the absolute file path. I would suggest that you try using a simpler path where the path does not contain spaces.
Thanks,
GLM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.