Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5241 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

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:

{[email protected], [email protected], 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 Guest
Posted

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

Image_1.png

Posted

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

Posted

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!

This topic is 5241 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.