Results 1 to 8 of 8
- 07-19-2010, 06:34 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 18
- Rep Power
- 0
Attachment File In Mail(Unknown Format)
Hi, In my program, using java, i am not able to get the attachment files in the same format (.jpeg,....etc,) as i send through mail.some time i am able to get, some time i get in unknown format.
Any idea to fix this or any new code regarding this...
Below is the Attachment Code Part.
Java Code:MimeBodyPart attachmentPart = new MimeBodyPart(); DataSource source = new FileDataSource(filename[i]); filedisplayname = filename[i].substring(filename[i].lastIndexOf("/")+1); attachmentPart.setDataHandler(new DataHandler(source)); attachmentPart.setFileName(filedisplayname); multipart.addBodyPart(attachmentPart);
{i am trying to attach mutiple Files in a mail.}
- 07-19-2010, 10:44 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Better to validate the content type.
Java Code:MimeBodyPart attachmentPart = (MimeBodyPart)part; // Main body part if (attachmentPart .isMimeType("text/plain")) { // Plain text } else { EMailAttach ema = new EMailAttach(); ema.name = decodeName(part.getFileName()); File savedir = new File([receiving_attachments]); // Make sure path exist File savefile = File.createTempFile("emailattach", ".atch", savedir ); // Save the path accordingly }
- 07-30-2010, 06:51 AM #3
Member
- Join Date
- Jun 2010
- Posts
- 18
- Rep Power
- 0
actually the attached file is opening in gmail bt in yahoo it is of unknown format. can any one guess what may b the reason.
- 07-30-2010, 05:43 PM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What's the attachment file extension in yahoo you found?
- 08-02-2010, 12:22 PM #5
Member
- Join Date
- Jun 2010
- Posts
- 18
- Rep Power
- 0
The file extention is the same as we give but in most mail servers i could not get that in rite format. Can any one give me another set of code which u may b using to attach files.
- 08-03-2010, 08:26 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
What you mean but not get the right format? Is it different from what you've attach and you downloaded from the other end?
- 08-04-2010, 06:14 AM #7
Member
- Join Date
- Jun 2010
- Posts
- 18
- Rep Power
- 0
Ya...Some unknown Format that v cant read
- 08-04-2010, 07:08 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
If it's happen only in Yahoo, then yahoo mailbox do some conversion. Did you check that?
Similar Threads
-
JavaMail - Problem while sending file attachment
By saniruddhabiswas in forum NetworkingReplies: 0Last Post: 06-13-2010, 11:16 AM -
Deleting an attachment after sending mail
By modestmj in forum Java ServletReplies: 2Last Post: 06-02-2010, 11:52 AM -
Mail Attachment as Source
By vinoopraj in forum Advanced JavaReplies: 2Last Post: 06-15-2009, 06:21 AM -
Send / Receive mail and download attachment
By Thennarasu in forum Advanced JavaReplies: 1Last Post: 05-29-2009, 11:59 PM -
kindly answer the queston in attachment file
By abhinav_jain09 in forum Advanced JavaReplies: 11Last Post: 09-19-2008, 04:47 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks