4 Replies Latest reply on Mar 7, 2016 6:52 AM by radeffect

    Server Scripts

    Ben_B94

      Hi,

       

      I am running FM Server v.14.0.2.226 on windows and trying to run a couple scripts but am having problems.

       

      Emails are sent via SMTP relay, all details entered in correctly. All of our email accounts are hosted on office-365. I've tested by running the script and sending to myself, it worked fine.


      When I schedule the script to run from the server it runs but I see in the logs error 1506 - emails not sent successfully. I do get emails in my inbox from the relay saying 2 addresses out of about 20 couldn't be sent to, is this what is breaking the script? Will the send mail script stop if it cant send a mail(stupid question I know)? What I mean is a variable is used to hold a found set of emails and it loops through each email, will this break completely out of the loop if the email isnt sent instead of just skipping to the next record?

       

      Secondly, I'm trying to send a report as pdf again from a scheduled script on the server, 2 problems save as pdf and insert file are not compatible but I recall reading that this could be done by saving the pdf in say the temp folder, then inserting the file from there into a container and then sending it. Have I got that wrong or is it just completely not possible?

       

      Thanks 

        • 1. Re: Server Scripts
          Magnus Fransson

          Hi Ben,

           

          As far as I knew the server is lacking the layout rendering engine. Since it can't render any layout it can neither print a layout nor export a layout as a PDF. And as nothing is exported nothing will be imported.

           

          Best regards Magnus Fransson.

          • 2. Re: Server Scripts
            Ben_B94

            Part 1 fixed by removing the emails it couldn't reach.

            • 3. Re: Server Scripts
              Ben_B94

              Hi Magnus,

               

              So is the best bet just to use a plug-in?

               

              Thanks

              • 4. Re: Server Scripts
                radeffect

                Hi Ben,

                As Magnus mentioned, FM server can't render a layout and therefore can't generate a PDF - a sore point for many many years for us developers.

                Although there are some complicated ideas out there, the simplest to date is using a 'bot', a client running FM Pro (often developers use the server itself despite it not being 'good practice') that can generate PDFs either by running a timed script to check for a raised flag or by triggering a script remotely on demand (I think Six Fried Rice came up with the idea, adopted by SeedCode too).

                If you already have the PDFs and don't need to generate, you can do this using 'insert from url' or by using the MBS plugin that has a ton of other useful functionality.

                 

                HTH,

                 

                Dan