Jump to content

Can't register a function


Noél Dubau
 Share

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

Recommended Posts

Hello,

I don't discover Scriptmaster plugin but I'm disappointed to day. FileMaker 12 ADV and Mavericks on an iMac 27 i5.

I put the pi in the extensions folder ; I opened Scriptmaster.fmp12 file and went on The sendEmail with attachments and ran successfully.  I asked to Register Function by copying to clipboard

RegisterGroovy( "SendEmailWithAttachments( from ; to ; subject ; body ; smtpHost ; attachmentPath )" ; "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"; "isGui=false" )

 I opened my fmFile and added in the opening script a line

Set variable  [$sendEmail ; Value : RegisterGroovy( "SendEmailWithAttachments( from ; to ; subject ; body ; smtpHost ; attachmentPath )" ; "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"; "isGui=false" )

No error message ; I closed scriptMaster.fmp12 and my file and reopened it : and I have a lot of errors I dont understand (see screencopy)

 

Hope in your help to unblind my eyes !

Noël

Capture d’écran 2016-01-06 à 13.44.18.png

 

Ashamed ! I just found I hadn't load jars....

But now I get the following message :

568d1c5d0ba59_Capturedecran2016-01-06a14

Hope your help ! Thanks

Edited by Noél Dubau
near by the solution....
Link to comment
Share on other sites

Hi Noél,

Are you getting the NullPointerException when opening your solution or when you try to use the function? 

Can you send me your logs? Please see this page for log locations. Please be sure to replicate the error before sending without any restarts of FileMaker as this will overwrite the logs. You can send the logs to [email protected] . Once I have those I should have a better idea as to what is going on. 

Link to comment
Share on other sites

Hello

I'm sorry to have disturb by that question ! I've found my problem : the function required jars and I hadn't load them !

Regards

Noël

How can I mark the question solved ?

Edited by Noél Dubau
Link to comment
Share on other sites

This topic is 2362 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
 Share

×
×
  • Create New...

Important Information

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