Jump to content

SuperContainer as email attachment in scheduled server script


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

Recommended Posts

Hello - 

 

I have been using SuperContainer for years and we use it to 'pipe' the SuperContainer URL as $attachmentpath to the Attachment section of the Filemaker Send Email Script step. This works perfectly when run on the client software. 

However, I cannot get it to run on a server side script, where I would like to send certain email attachments automatically at certain times of the day. 

 

I do have the SuperContainer companion installed on FMS18 on a Mac - is there any pearls of wisdom anybody could share? Has anybody done this? Thank you. 

 

 

Link to comment
Share on other sites

Hi DataCruncher,

If you are using the native FileMaker Send Mail script step then for server-side scripts if you attach a file, that file needs to be in a folder that server-side scripts are allowed to access. Are you downloading the file using the companion plugin prior to attaching it to an email? If so, are you downloading it to a file path or to a container?

Link to comment
Share on other sites

Thank you Ryan. That is a really interesting approach, because on the client, I just use the URL that SuperContainer rests at. I figured server-side I would have to download, but was not quite sure how to tell when the download has finished. 

I did a SCDownload to the Temp folder - but the script still won't pick up on the email attachment. Could this be because the script has no way of telling when the Download has finished is is trying to look for a filename that does not (yet) exist, and if so, how do I navigate around that? Is there a 'wait for complete' option on SuperContainer or can I use some sort of WAIT directive? 

But since you asked about whether I download to a file path or container, do you think a container would be the better option? 

Link to comment
Share on other sites

In my experience the only place that FMS most definitely has read/write permissions to is its own Documents folder. I suspect it doesn't have read permissions to the tmp location.

Downloading to a container will eliminate the need for correct permissions but means that file will reside in your database so you may want to clear the container as a part of the script if you do not want to store the file within the database. I don't think you will need to wait for the download to complete as script steps should execute chronologically and shouldn't execute until the previous step has completed. Please keep in mind that if you take the container approach, you will probably need to add context to your script like go to layout, go to record to ensure the field reference is referencing the intended container.

Link to comment
Share on other sites

Well, bummer. 

So I managed to download the file with the SCDownload function to my /Users/user/Downloads folder. 

Problem being - server side, that folder is 'invisible' to the server side scripting engine. 

 

When I followed the advice to try and download the document to the own Documents Folder at /Library/FileMaker\ Server/Data/Documents - guess what? The file doesn't save!

 

I have tried everything in my might. I made a tmp folder under the FMS Documents root. Set permissions to 777. Changed ownership. Nothing will get it to work. What on earth am I doing wrong? 

Link to comment
Share on other sites

22 minutes ago, DataCruncher said:

When I followed the advice to try and download the document to the own Documents Folder at /Library/FileMaker\ Server/Data/Documents - guess what? The file doesn't save!

Are you capturing for errors on SCDownload? If so, are there any errors being set? 

Link to comment
Share on other sites

Well look at that: 

 

java.lang.IllegalStateException: Could not create directory: /Library/FileMaker\ Server/Data/Documents

 

But the directory already exists. Weirdness.  

Also, all permissions are set properly. I am wondering if I am not escaping the empty space in the path correctly? 

 

Solved the download part of it. 

The file is now stored in Documents/Filename. 

This path is then set as a variable: 

$path="file:Documents/Filename"

 

Only, when I add $path as attachment path to the send email server side script, nothing is attached? 

Link to comment
Share on other sites

That worked for the download part- the file now correctly downloads to the folder. However, when attaching to the attachment path, it still does not attach. I have no idea how to track the problem down here. 

The $path variable correctly comes through as:

 

filemac:/Library/Filemaker Server/Documents/TEST.docx

 

Only it does not attach.... This is on FMS18 on a Mac. 

Link to comment
Share on other sites

If you are using the native Send Mail script step then I am not sure how to assist. You may need to post in a more general section of the forums so that the question is more visible to users not specifically looking in the 360Works specific section. That being said, since this is server side, you may can check the Event.log file for any errors being set during the Send Mail call. The documentation for the function here might be of help as well as this page on creating file paths.

Link to comment
Share on other sites

Yes it should be able to do that. You can try the plugin out for free in demo mode but you will need to restart the FMSE after two hours of it running or you will get demo mode errors. The plugin process is still going to run under the FMS user so you will probably have to deal with the same permissions so I would still download the file to the FileMaker Server Documents folder. However, if you have an issue with the email plugin picking up the attachment path, I would be able to take a look at the plugin logs to see why. 

Link to comment
Share on other sites

This topic is 1673 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.