Attach pdf file

24 views
Skip to first unread message

Salvatore Picozzi

unread,
Jan 23, 2013, 3:36:18 AM1/23/13
to ent...@googlegroups.com
How to attach pdf file with sendmixedmail()?

Code:

Properties pdf = new Properties();
File f = new File("C:\\Documenti\\newsletter\\Newsletter.pdf");
pdf.store(new FileOutputStream(f), null);

Thanks

Elia Mezzano

unread,
Jan 23, 2013, 4:20:12 AM1/23/13
to ent...@googlegroups.com
Hi Salvatore,
as pointed out in the IMailManager.sendMixedMail(...) javadoc:
Parameters:
....
attachmentFiles The attachments mapped as fileName/filePath.
....
So, your code can be modified to something like:

Properties pdf = new Properties();
String f = "C:\\Documenti\\newsletter\\Newsletter.pdf";
pdf.store("Newsletter.pdf", f);
....
this.getMailManager().sendMixedMail(...., pdf, ....);

Regards

Elia

Salvatore Picozzi

unread,
Jan 23, 2013, 5:00:09 AM1/23/13
to ent...@googlegroups.com
There isn't method store(String,String) in class Properties.

Elia Mezzano

unread,
Jan 23, 2013, 9:02:01 AM1/23/13
to ent...@googlegroups.com
Il giorno mercoledì 23 gennaio 2013 11:00:09 UTC+1, Salvatore Picozzi ha scritto:
There isn't method store(String,String) in class Properties.

I'm sorry, it's a mistake re-using your previous code.
The goal is to populate a Properties object with pairs of <File Name> / <File Path>
So the code can be something like:
Properties attachments = new Properties();
attachments.setProperty("Newsletter.pdf",  "C:\\Documenti\\newsletter\\Newsletter.pdf");
this.getMailManager().sendMixedMail(...., attachments, ....); 

Salvatore Picozzi

unread,
Jan 24, 2013, 3:13:38 AM1/24/13
to ent...@googlegroups.com
Thanks!!
Reply all
Reply to author
Forward
0 new messages