Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SendMail with attachment (resolved)

Featured Replies

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

Try leaving off the file: prefix, so just do this:

/Data/Downloads/FMP/mail_SM.fp7

  • Author

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

  • Author

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

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!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.