Thanks for the reply. The pdf was created by a previous script on a client, this one line script is just running send mail to attach a pdf already there to an email and send it. Will attach it perfectly when the script is run on the client, but sends email with no attachment when run on the server.
Can you provide some additional information -- specifically, where is that PDF located, and how are you passing the location to the server script?
It seems as if I've put that pdf everywhere but on the ceiling. This is running on a mac mini, the location is specified in the Send Mail script step by clicking on the Specify button, then using the "Add File" button and navigating to the various paths I tried which included the documents folder as documented - tried both in the library/fmserver/... folder (not at work so guessing path) and the user/documents folder where the Get (DocumentsPath) function told me it was looking when run on the client. Summary: I used many locations mapped carefuly with copies of the file and could never get one to attach when run on the serverside, works every time on the client.
In that link it says "FileMaker Server scheduled scripts support sending mail via SMTP. However, if you attach a file, that fileneeds to be in a folder that FileMaker Server is allowed to export to. For more information,
I saw that and used the func above and saw the path while running on the client using data viewer, it was /user/documents which I use (and works) when running on the client.
I've used every path under the sun when running serverside with a file waiting to be attached. I used the Documents folder in the Filemaker directories in the library folder... different combos, none worked so anyone know definatively what "folder that Filemaker Server is allowed to export to." I should be using?
Thanks again for the help everyone.
The result of Get function on server is different from on client.
Use variable in path to work on both server and client like as
Set Variable[$path;Get(DocumentsPath) & "filename.pdf"]
And check the file permission for the user running scheduled script.
As user19752 has mentioned, the user's document path is not the same as the server's document path. So, two things...
First, the PDF must be located in the FileMaker Server/Data/Documents directory for the server to find it.
Second (as user19752 has already mentioned), you can get the path to that folder using Get ( DocumentsPath).
When you run your script from a client, that will give you the user's document path. When you're running it as a server script, that will give you the server's document path.
You can use MBS Plugin.
CURL functions can send email with attachments.
DynaPDF functions can create PDF cross platform.
Thanks, difference in doc paths has been understood since beginning - issue - can't view documents path result when running on server just as confirmation of serverside path... have used relative paths, created variable $$path and had pdf setting in all of the locations below but send mail still doesn't attach file to the email it sends.
Paths I'm using:
filemac:/Server HD/Library/FileMaker Server/Documents/RevRep.pdf
I've checked permissions and have them for the name of the server; admin; fmserver; fmsadmin; everyone (all except "everyone" has read/write, "everone" has read only.
user19752: You mention check the file persmission for the user running the scheduled script... I take it this is the user from the mac OS X point of view? Regardless however I've added permissions for everyone I can think off.
I'm starting to think this is a bug vs an oversite on my part but hope to be set straight. Has anyone responding successfully used "Send Mail" running on the FM13 serverside to attach and email an existing document like I'm trying to do?
I have just checked the path returned by my FMS Server 13.0v4 as a result of the function: Get(DocumentsPath)
Result: /Kiev HD/Library/FileMaker Server/Data/Documents/
This machine is called Kiev and is a Mac Mini running 10.9.4.
You can see that my result has a ‘Data’ folder in the path - maybe yours needs this too …
Best wishes - Alan Stirling, London UK.
And a FYI...
On the FMS admin console log viewer there is an entry whenever this script runs that says
event 645; Description: Schedule "Email Rev.Report" scripting error (3) at "OMS Reports : Open Script: Adjust Window".
This seems to show an error on the "Open Script: Adjust Window" script step but we don't use that in this script... does that make sense?
To answer your question, yes, I've successfully sent attachments with a server 13 scheduled script using the Send Mail step.
Maybe this is just an oversight, but I notice that none of the paths you listed matched what I suggested (and what Alan suggested in his response above).
You've listed Library/FileMaker Server/Documents/RevRep.pdf.
You need Library/FileMaker Server/Data/Documents/RevRep.pdf
Note the 'Data' directory within that path.
Nonetheless, rather than fussing with the path, I again suggest that you use Get ( DocumentsPath) to get the path reliably in both the client and server contexts.
Regarding the error you're seeing..
Do you have a script that runs when the file opens? If so, that script will run when the server runs your scheduled script, unless you add code to suppress it. That script may contain the 'Adjust Window' script step.