4 Replies Latest reply on Jun 22, 2011 11:04 PM by Stuee

    Using script on server

    Stuee

      Title

      Using script on server

      Your post

      Hi, i have setup a DB and run it from my win7 pc.

      i have a problem now that ive got the server setup and deployed it to run local network to 4 clients around the office.

      The problem is the script below, runs ok from my outlook for sendmail but when i run on another pc it tries to oepn outlook which isnt installed.

      I do have office2010 onstalled on my 2008 R2 server 64bit and would like the script to run on that so it only uses smtp outlook to send from that, i also would like it to send store some sort of details saying when email was sent like in send folder but as the server isnt man used i dont want any dialog boxes etc.

      Script below.. and the server name is as you can see in the link to where it stores the quote pdf file...

      Emailpdf-Invoice
      Go to Layout [ “Invoice” (Ordering) ]
      Set Variable [ $filePath; Value:"filewin://BP_SERVER/Work_drive/Important_BP/FM_Invoices/" & Ordering::Order ID & "-Invoice.PDF" ]
      Save Records as PDF [ File Name: “$filePath”; Create email; Current record ]
      [ Document - Title: "Quote"; Subject: Ordering::Order ID; Author: "******* ******"; Compatibility: Acrobat 7 and later ]
      [ Pages - Number Pages From: 1; Include: Specific Pages; Start Page: 1; End Page: 1 ]
      [ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ]
      [ Initial View - Show: Page Only; Page Layout: Single Page; Magnification: 100% ]
      [ Restore; No dialog ]
      Send Mail [ Send via SMTP Server; To: Clients::Client Email; Subject: Ordering::Order ID& " Invoice"; Message: "Hi "& Ordering::Client
      Name First& ",¶"&
      "¶"
      &"Attached is your Invoice for your recent order "& Ordering::Order ID& ",¶"&"
      If you have any questions don’t hesitate to ask."&"¶"
      &"¶"
      &"Thanks"&"¶"
      &"********"; Attachment: “$filepath”; Name: "*******s"; Email Address: "*****@*******.com.au"; Reply-To Address:
      "*****@*****.com.au"; SMTP Server: "smtp.*********.com.au"; Port: 587; Authentication Type: Plain Password;
      User Name: *****@******.com.au"; Password: "*******" ]
      [ No dialog ]
      Go to Layout [ “Ordering” (Ordering) ]
      Insert Current Date [ Ordering::Invoice Emailed ]
      15 June 2011 15:05:00 BP_Main - Emailpdf-Invoice -1-

        • 1. Re: Using script on server
          Stuee

          oh and thanks for any input :)

          • 2. Re: Using script on server
            TSGal

            Stuee:

            Thank you for your post.

            I'm a bit confused.  When you send to an SMTP server, it should not open the local Email client, so I'm concerned that the email client is being opened.

            Since there will be no reference in your email client when sending via SMTP server, you may want to log the email sent in another table as you send it.  That is, add a record to a table, date and time stamp it, include the email address.  After the Send Mail script step, you may also want to capture an error code (if exists) and update that field.  That way, you can look back later to see what emails were sent, or what emails were having trouble being sent.

            Let me know if you need additional clarification.

            TSGal
            FileMaker, Inc.

            • 3. Re: Using script on server
              DavidJondreau

              At the beginning of your script, add the script steps Allow User Abort[Off] and Set Error Capture[On]. When a server script encounters an error, it will stop if User Abort isn't set. Error Capture suppresses any dialogs which don't apply to a server script.

              The error the script is encountering and aborting is when you Save as PDF, it's set to create an e-mail. Filemaker Server doesn't have the ability to talk to an e-mail application, such as Outlook. You're using Send Mail as SMTP which is right and which does what your e-mail app does.

              You can attach the pdf by specifying the $filepath in the Send Mail script step.

              • 4. Re: Using script on server
                Stuee

                Hi.

                when i set as sendmail it for some reason opens my outlook software and the email has the pdf attached but thats all?

                is there also a way i can use the sendmail on the server so i dont have to use the script on each pc.