Results 1 to 3 of 3
- 06-02-2010, 08:01 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 2
- Rep Power
- 0
Deleting an atatchment after sending mail
Hello everyone..
I'm trying to forward a PDF with a mail and also delete it from the tomcat/bin folder after sending it as it gets generated in that folder. But the problem is if I try to use the delete method, the file is deleted even before the mail is sent. So I was hoping if anyone could help me on this.
Java Code:File[] pdfFile = {DownloadProfile.generateProfile(profileId, "pdf", request, response)}; //Format Subject: String subject = ContentUtil.get("com/inikah/template/common-subject.txt"); subject = subject.replace("[$mail-context$]", "Please Check This Pdf"); subject = subject.replace("[$profile-name$]", profile.getProfileName()); subject = subject.replace("[$profile-code$]", profile.getProfileCode()); //Format Body: String body = ContentUtil.get("com/inikah/template/profile/profile-attachment.html"); body = body.replace("[$contact-person$]", "Sr/Br"); body = body.replace("[$profile-name$]", profile.getProfileName()); body = body.replace("[$profile-code$]", profile.getProfileCode()); for (String toAddress: email) { if (Validator.isNotNull(toAddress)) MailUtil.sendMail(toAddress, subject, body, pdfFile); } pdfFile[0].delete();
- 06-02-2010, 11:44 AM #2
Once is enough.
Deleting an attachment after sending mail
db
-
Similar Threads
-
Java Mail sending
By jazz2k8 in forum Advanced JavaReplies: 1Last Post: 05-01-2011, 06:08 AM -
Deleting an attachment after sending mail
By modestmj in forum Java ServletReplies: 2Last Post: 06-02-2010, 11:52 AM -
problem with sending mail usin javaX.mail api
By sandeepsai39 in forum New To JavaReplies: 4Last Post: 11-25-2009, 05:37 AM -
Sending a Mail
By haiforhussain in forum Advanced JavaReplies: 7Last Post: 07-30-2008, 12:28 AM -
Sending a mail with the local mail program
By thedude in forum Advanced JavaReplies: 2Last Post: 07-23-2007, 12:19 PM


LinkBack URL
About LinkBacks

Bookmarks