Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-04-2009, 11:33 AM
Member
 
Join Date: Mar 2009
Posts: 9
Rep Power: 0
Malathi is on a distinguished road
Default Attachments were missing when mail was sent through java mail API
Dear Experts,

Our web application is based on struts and we are using java mail API to send mails to USA clients through our application.The problem is, they could able to receive the mail but they coudn't able to receive the attachments.

Could you please let me know the problem behind that ASAP

Regards,
Malathi
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 06-04-2009, 12:59 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,523
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Better you should provide more details. How did you do that, and what happen(any observations) when you receive a mail with an attachment? And such details much helpful to others, commenting on.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-04-2009, 02:42 PM
Member
 
Join Date: Mar 2009
Posts: 9
Rep Power: 0
Malathi is on a distinguished road
Default
Properties props = System.getProperties();
props.put("mail.smtp.host", "10.0.1.6");
Session session1 = Session.getDefaultInstance(props, null);
MimeMultipart multipart = new MimeMultipart("related");
MimeMessage message = new MimeMessage(session1);
message.setFrom(new InternetAddress(mailFromAddress));
message.setSubject(mailSubject);
MimeBodyPart messageBodyPart1 = new MimeBodyPart();
messageBodyPart1.setContent(mailContent, "text/html");
multipart.addBodyPart(messageBodyPart1);

FileDataSource fds1 = new FileDataSource(pdfFilePath);
MimeBodyPart messageBodyPart2 = new MimeBodyPart();
messageBodyPart2.setDataHandler(new DataHandler(fds1));
messageBodyPart2.setFileName(fds1.getName());
multipart.addBodyPart(messageBodyPart2);
message.setContent(multipart);
message.addRecipient(Message.RecipientType.TO,new InternetAddress("malathi@gmail.com"));
message.addRecipient(Message.RecipientType.CC,new InternetAddress(maatharasi@gmail.com));
Transport.send(message);

it is sending for few users the mail with attachments correctly but for few users, it is sending the mail but it is missing the attachments.

let me know if anybody is knowing the solution ASAP because the application is running in live server
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Mail sending jazz2k8 Advanced Java 0 03-31-2009 07:59 AM
Javax.mail.MethodNotSupported Exception in java mail api namarc Advanced Java 2 05-05-2008 07:01 AM
Retreiving of mail body using mail number chandu.v09 JavaServer Pages (JSP) and JSTL 0 03-13-2008 03:25 PM
Send a pic through mail, in java lenny Advanced Java 1 07-25-2007 03:49 PM
Sending a mail with the local mail program thedude Advanced Java 2 07-23-2007 01:19 PM


All times are GMT +2. The time now is 07:43 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org