|
Your continued generosity and support of FMForums is greatly appreciated. |
Noël Dubau
enthusiast
Posts: 50
Post Rank (AVG):
FMP: 9 Advanced OS: Cross Platform Skill: Intermediate
Tweet This Post!
|
Hello,
I'm trying to attach a file to a SendMailWithAttachment but I can't in my database and even from your sample. The error is always relative to the path
javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.FileNotFoundException: Data/Downloads/FMP/mail_SM.fp7 (No such file or directory)
Parameters:
{from=noel.dubau@wanadoo.fr, to=ndubau@free.fr, subject=Just a test (with attachment), body=I'm testing the "sending email with attachments" utility in ScriptMaster. Works great! Special characters test: éüîñ, smtpHost=smtp.free.fr, attachmentPath=Data/Downloads/FMP/mail_SM.fp7}
---Script---
Script:
import javax.mail.*;
import javax.mail.internet.*;
Properties props = new Properties();
props.setProperty("mail.smtp.host", smtpHost);
MimeMessage msg = new MimeMessage(Session.getInstance(props));
Multipart content = new MimeMultipart();
// first the message body
MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setText(body, "UTF-8");
content.addBodyPart(bodyPart);
// then the attachment
MimeBodyPart attachmentPart = new MimeBodyPart();
attachmentPart.attachFile(attachmentPath);
content.addBodyPart(attachmentPart);
msg.setContent(content);
msg.setSubject(subject);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
Transport.send(msg);
return true
At first I tried filemac:/Data/Downloads/FMP/mail_SM.fp7
then file:/Data/Downloads/FMP/mail_SM.fp7
and many other ways including /Volumes... The file is really present !
Can you help me ?
Noël
Edited by Noël Dubau on 07-30-10 10:15 PM. Reason for edit: No reason given.
|
360Works offers a complete line of FileMaker plugins and add-ons targeted at FileMaker developers. |
Jesse Barnum
journeyman
Posts: 276

Loc: Atlanta, GA
Post Rank (AVG):
FMP: 11 Advanced OS: Mac OS X Snow Leopard
Member: TechNet, FBA, Platinum Skill: Expert
Certified:
FMPug
Tweet This Post!
|
In response to Noël Dubau
Try leaving off the file: prefix, so just do this:
/Data/Downloads/FMP/mail_SM.fp7
|
Noël Dubau
enthusiast
Posts: 50
Post Rank (AVG):
FMP: 9 Advanced OS: Cross Platform Skill: Intermediate
Tweet This Post!
|
In response to Jesse Barnum
Oh ! I tried too... unsuccessfully ! I tried with others files without more success.
Version SM 4.01 , iMac Leopard 10.5.8, java build 1.5.0_24-b02-357-9M3165
|
Noël Dubau
enthusiast
Posts: 50
Post Rank (AVG):
FMP: 9 Advanced OS: Cross Platform Skill: Intermediate
Tweet This Post!
|
In response to Noël Dubau
I've found the correct syntax on Mac
/Volumes/Data/Downloads/FMP/mail_SM.fp7
Now I'll go and see how to get it in a FileMaker calculated field
Noël
|
|
Your continued generosity and support of FMForums is greatly appreciated. |
Jesse Barnum
journeyman
Posts: 276

Loc: Atlanta, GA
Post Rank (AVG):
FMP: 11 Advanced OS: Mac OS X Snow Leopard
Member: TechNet, FBA, Platinum Skill: Expert
Certified:
FMPug
Tweet This Post!
|
In response to Noël Dubau
OK, I assumed that 'Data' was the name of your boot drive. In that case, the path would look like:
/Data/Downloads/FMP/mail_SM.fp7
However, whenever you're referencing a hard drive that is NOT your boot drive, you need to stick /Volumes before it, as you discovered. Good luck!
|
360Works offers a complete line of FileMaker plugins and add-ons targeted at FileMaker developers. |