1 Reply Latest reply on Apr 20, 2012 12:43 PM by TSGal

    Creating a script to send an email with a pdf attached in FMTG

    silverbasil

      Title

      Creating a script to send an email with a pdf attached in FMTG

      Post

      Am a newbie.

      I have created a script which creates a pdf from a layout and attaches itself in the message of an email.ie the current layout  In addition i can extract text related to name and date to popolaute the message header and accompanying text in the email.  All works ok in FM 12 on desktop.

      When i move the DB file to FMTG the email is created but no pdf is attached.

       

      What am i doing wrong?

        • 1. Re: Creating a script to send an email with a pdf attached in FMTG
          TSGal

          Andrew Silvers:

          Thank you for your post.

          Since you didn't post a script, try using the following:

          Set Variable [ $PDFPath ; Value: Get (DocumentsPath) & <filename.pdf> ]
          Send Mail [ Send via E-mail Client ; To: <email address> ; ....  ; "$PDFPath" ]

          If you want this to work on both FileMaker Pro and FileMaker Go, you can use Get (SystemPlatform) to determine if this is on an iOS device or Mac/Windows computer.  The function Get (SystemPlatform) returns "3" if it is an iOS device.  For the following example, assume the PDF file generated is called "Invoice.pdf".  The script may look like: 

          -----

          If [ Get ( SystemPlatform ) = 3 )

             Set Variable [ $FileName ; Value: "Invoice.pdf" ]
             Save Records as PDF [ No dialog ; "$FileName" ; Records being browsed ]
             Set Variable [ $PDFPath ; Value: Get (DocumentsPath) & $FileName ]
             Send Mail [ Send via E-mail Client ; To: "user1@abc.com" ; Subject: "Invoice" ; Message: "Test" ; "$PDFPath" ]

          Else

             <your current script step(s) to send the PDF file on the Windows/Mac machines.

          EndIf

          -----

          Let me know if you need clarificaton for any of the above steps.

          TSGal
          FileMaker, Inc.