ScriptMaster is a free, general-purpose, modular plugin for FileMaker Pro. It comes out of the box with modules for file manipulation, URL and network utilities, Web Services, shell scripting, event/script triggering, and many others. Please use this discussion area to post questions and suggestions.



304 Views    -    4 Replies


Username Post: SendMail with attachment (resolved)        (Topic#215940)
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! Tweet This Post!
07-30-10 07:24 AM - Post#361809     - Post Rank:             


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:
  • Quote:
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
  • Quote:
filemac:/Data/Downloads/FMP/mail_SM.fp7

then
  • Quote:
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
Jesse Barnum

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! Tweet This Post!
07-30-10 08:05 AM - Post#361811     - Post Rank:             
    In response to Noël Dubau

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

/Data/Downloads/FMP/mail_SM.fp7
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Noël Dubau 
enthusiast
Posts: 50

Post Rank (AVG):
            


FMP: 9 Advanced
OS: Cross Platform
Skill: Intermediate



Tweet This! Tweet This Post!
07-30-10 08:16 AM - Post#361812     - Post Rank:             
    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


Attachment: Image_1.png (100.91 KB) 14 View(s)












Noël Dubau 
enthusiast
Posts: 50

Post Rank (AVG):
            


FMP: 9 Advanced
OS: Cross Platform
Skill: Intermediate



Tweet This! Tweet This Post!
07-30-10 11:23 AM - Post#361822     - Post Rank:             
    In response to Noël Dubau

I've found the correct syntax on Mac
  • Quote:
/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
Jesse Barnum

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! Tweet This Post!
07-30-10 04:04 PM - Post#361859     - Post Rank:             
    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!
--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











360Works offers a complete line of FileMaker plugins
and add-ons
targeted at FileMaker developers.

Icon Legend Permissions Topic Options
Print Topic

Email Topic

304 Views
Welcome Guest...
Enter your username and password to login. If you do not have a username you can register one here

Username

Password

Remember me. Help



Forgot Password...


Quick Links
Recent Posts
Active Topics
No Replies
Recent Files
Functions & Scripts
FileMaker Pro Help
FileMaker on Twitter
FileMaker Marketplace

Custom Search

Find FileMaker Developers

Don't have time to wait,
hire a developer now!

Recent Members
Welcome them to our community!
Find FileMaker Jobs

Want a new career?
Find your new job now!

Joy of Tech
Latest Joy of Tech!

Recent Topics
Recent Hot Topics
Contribute
With your generosity we can make some real magic happen!. Support your favorite online FileMaker community...
FM Forums.com


Click here...


Or a Donation of any amount.


Thanks for your support!

Active Blogs
0 Recent blogs:
People to Post Lately in this Topic
Noël Dubau
Jesse Barnum
FM Forums Advertisers


FusionBB™ Version 3.0 FINAL | ©2003-2010 InteractivePHP, Inc.
Execution time: 0.23 seconds.   Total Queries: 74   Zlib Compression is on.
All times are . Current time is 01:26 PM
Content ©1996-2008 Ocean West Consulting, Inc. All Rights Reserved
Ocean West Consulting, Inc. can not and will not be held responsible for any of the contents in this site.
FM Forums™ is a trademark of Ocean West Consulting, Inc an independent entity, not affiliated with FileMaker Inc.
FileMaker® is a registered trademark of FileMaker Inc.
Top