Noél Dubau Posted July 30, 2010 Posted July 30, 2010 (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 July 31, 2010 by Guest
Jesse Barnum Posted July 30, 2010 Posted July 30, 2010 Try leaving off the file: prefix, so just do this: /Data/Downloads/FMP/mail_SM.fp7
Noél Dubau Posted July 30, 2010 Author Posted July 30, 2010 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 Posted July 30, 2010 Author Posted July 30, 2010 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
Jesse Barnum Posted July 30, 2010 Posted July 30, 2010 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!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now