January 6, 201610 yr 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 Ashamed ! I just found I hadn't load jars.... But now I get the following message : Hope your help ! Thanks Edited January 6, 201610 yr by Noél Dubau near by the solution....
January 6, 201610 yr 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.
January 6, 201610 yr Author 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 January 6, 201610 yr by Noél Dubau
Create an account or sign in to comment