Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I have been successful in creating an HTML email from ScriptMaster that I can get to email with FileMaker Advanced Pro 11. I also have FileMaker Server 11 and I have set the script to run as a schedule. I have added the ScriptMaster plugin to the extensions folder in FileMaker Server and restarted the server (like I have read in the instructions in many other poses) and the scheduled script still does not send an email. I have the latest version of ScriptMaster and it is set to register the HTML email on startup.

Can anyone offer any help or suggestions?

Thanks,

Jonathan

Posted

Can you post a copy of the script? There are so many variables. I'd start very basic and build up.

To avoid context issues, build a simple script with a hard-coded email. That is, don't attempt yet to pull data from fields into the email.

The other things to check are Java versions and ScriptMaster versions. Also, I find it helpful to use Set Field to capture SM Last Error, if any. Then, you can check that field from a client.

Posted (edited)

Are you sure you're in the right layout when server runs this script? I don't see a go to layout UI (and so you'd have a context issue). I also don't see where you're loading SM or registering it. Is there an Open script?

Do you have a one record table (prefs)? By setting a text field in this table, you can begin to troubleshoot.

Write a two line script and schedule it with Server:

Go to Layout (layout that is based on table occurrence of one record table)

Set Field (smExists), SMVersion

This'll let you know if FMS loaded ScriptMaster.

Then, you can use this technique right after your Set $script.result step. Again, Go to Layout (table w/ one record), Set someTextField, SMLastError.

Edited by Guest
Posted (edited)

Thank you for your help. I hope we're getting closer to a solution.

  • Tried having script go to the UI table first (Didn't work on FMServer)
  • Tried Opening Scriptmaster and closing it, but FMServer doesn't support opening or closing of a file in a script.
  • Tried simplifying the email to send simple text (didn't work in FMServer, but did in FMPro)
  • Tried using an authentication email (didn't work with FMServer, but did with FMpro)
  • Tried capturing the SMlasterror. This is what it read:
    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, Script1.groovy: 1: unexpected token: ? @ line 1, column 1.
    1 error


    Parameters:
    {}

    ---Script---
    Script:
    ?

    I HAVE NO IDEA WHAT THAT MEANS

THis is the script:

________

Test: Test Email

Set Error Capture [ On ]

Set Variable [ $script.result; Value:EvaluateGroovy(SendEmailWithAuthentication( "[email protected]" ; "[email protected]" ; "subject" ; "htmlBody" ; "" ; "smtp.me.com" ; "•••••••••••" ; "•••••••" )

)]

_______

Any "•" are to hide sensitive info.

Again this works through FileMaker Pro, but not FMServer.

Any thoughts?

Edited by Guest
Posted

You haven't brought the necessary jar files into your solution? You're relying on the ScriptMaster file?

You have not answered my questions from my previous post. Do you have a single record table?

Forget email. Can you simply set a field (in the single record table) to SMVersion?

"Tried having script go to the UI table first (Didn't work on FMServer)" Why didn't it work (btw, when you say go to the UI table, what do you mean? Go to a layout based on the UI table, I hope).

Posted

Bcooney, thank you for helping and being patient with me.

I am relying on the ScriptMaster file and I don't know how to bring in the necessary .jar files into my solution. In FMPro I simply open ScriptMaster and then close it and it registers the functions that I need (ie. HTML email). I assumed it would do the same for SMServer. Any help on "bringing in the necessary" .jar files?

Another solution that I tried recently was putting the script step in my HTML email script that registers the HTML Email function (the same one I used in my open script). This still allows FMPro to send an email, but not FMServer.

When trying to have FMServer set a field to the SMVersion, I can get FMServer to set a field in a single record table to SMVersion (it places 3.32 in a field).

When I say that I tried having the script go to the UI table first and it didn't work, I meant that I added a step Go To Layout with a layout in the UI table that had all of the necessary fields on it and that didn't solve my overall problem of getting the email to send.

Any help is always appreciated, and of course again thank you for being patient with me. I know that FMServer has loaded ScriptMaster because it shows it in the plugins in FMServer console, but it seems that FMServer isn't registering the function, or there aren't the appropriate .jar files brought in.

Posted

I don't use the ScriptMaster file, I bring everything into my file.

I haven't used their Send HTML email function (I use their 360works email plugin). However, if it works the same as other SM functions you need to:

1. Create a container field in your file. Insert the Mail.jar file into that container.

2. In your Startup script, use the SMLoadJar function to load the Mail.jar.

3. In your Startup script, set a $var to the RegisterGroovy string you need:


$result = RegisterGroovy( "SendEmail( from ; to ; subject ; body ; smtpHost )" ; "import javax.mail.*;¶

import javax.mail.internet.*;¶

¶

Properties props = new Properties();¶

props.setProperty("mail.smtp.host", smtpHost);¶

MimeMessage msg = new MimeMessage(Session.getInstance(props));¶

msg.setText(body);¶

msg.setSubject(subject);¶

msg.setFrom(new InternetAddress(from));¶

msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));¶

Transport.send(msg);¶

return true;¶

" )

Now your file is independent of the Scriptmaster file. Their documentation is found by clicking the Documentation button in the footer of the ScriptMaster file. Then click the ScriptMaster button in the Header. See "Registering functions" and "Advanced Techniques."

  • Like 1

This topic is 5246 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
×
×
  • Create New...

Important Information

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