9 Replies Latest reply on Feb 17, 2013 8:15 PM by MarkNZ

    Email a Saved Open Storage Document

    MarkNZ

      Hi all,

      What is the best way to email a pdf which has been saved in the default folder?

      I would like to be able to have a button scripted to open a pdf held in a container field on a layout and have it attached to an email.

      Currently I can export ( open) a document from within a container field, but the email attchment requires the origin of the file ..off course.

      Your thoughts apprecaited.

        • 1. Re: Email a Saved Open Storage Document
          robwoof

          Hi Mark,

          If the user is to write the content of the email, the "Export Field Contents" command has an option to "Create email with file as attachment", so:

           

          Set Variable [ $filename ; <somethingOrOther>.pdf ]

          Set Variable [ $path ; Get ( TemporaryPath ) ]

          Export Field Contents [ $path/$filename ; Create email with file as attachment ]

           

          If the entire email content is generated from the database as well, then you might use

           

          Set Variable [ $filename ; <somethingOrOther>.pdf ]

          Set Variable [ $path ; Get ( TemporaryPath ) ]

          Export Field Contents [ $path/$filename ]

          Send Mail [ SMTP or client ; attach file: $path/$filename ]

           

          HTH

           

          Rob

          • 2. Re: Email a Saved Open Storage Document
            MarkNZ

            Thanks Rob appreciated..

            • 3. Re: Email a Saved Open Storage Document
              MarkNZ

              Hi Rob,

              When I get to.... Export Field Contents [ $path/$filename ; Create email with file as attachment ] how do I get the email address field automatically in the email..?

              I can get the new Email hapening ok but with no address address..?

               

              If I Insert the Send Email script then i have an option to Insert the Email address field, but how can I tie this in correctly with your suggestion..

               

              This is what I have done..Email Container file.JPG

               

               

              Regards Mark

              • 4. Re: Email a Saved Open Storage Document
                robwoof

                Hi Mark,

                 

                It looks like you are mostly there. A couple of points from your screen shot:

                1) The Export Field Contents step needs to have the "Specify File…" set to $final_path, otherwise there is nothing there for the Send Mail step to pick up and attach to the email.

                2) Unfortunately the detail view of the image does not show the full calculation of the filename, but I should mention that you can call the exported file anything you like. You don't need to know the original filename of the container field contents - you can call the exported file whatever you like.

                3) The Send Mail script step doesn't allow the user to enter a Subject or Body, so you need to consider how to fill in those parts of the email fromt he database. Alternatively, you can use a global field or two and a dialog box or separate layout to ask the user to enter Subject and Body before sending.

                 

                I'm not sure that answers your questions fully, so please feel free to ask for further clarification.


                Rob

                • 5. Re: Email a Saved Open Storage Document
                  MarkNZ

                  Hi Rob, thanks for your thoughts..  This is where im at with it now... just need to have the email auto insert the email address field...your thoughts

                  Email Container file2.JPG

                  • 6. Re: Email a Saved Open Storage Document
                    robwoof

                    Sorry, Mark, I may not have been clear, and I didn't check a couple of things properly.

                     

                    If you want the address for the email to come from FileMaker, you need to use the Send Mail step as per your earlier screen shot. If you use the "Email client" option in Send Mail, you can leave the "Perform without dialog" option deselected. That will then allow the user to enter a subject and message before sending.

                     

                    I hope that clears it up now.

                     

                    R

                    • 7. Re: Email a Saved Open Storage Document
                      MarkNZ

                      OK Rob Ive got it working apart from this dialog appearing, asking me to Save or Cancel...I dont wanty this to appear at all...As soon as you select Save or cancel the email appears with attachment which is correct...any thoughts

                      PS: Email Client option is the option Im using..Mark

                       

                       

                       

                       

                       

                       

                      Email3.JPG

                      1 of 1 people found this helpful
                      • 8. Re: Email a Saved Open Storage Document
                        robwoof

                        OK, that dialog looks like the "Export Field Contents" dialog. If you are using the Send Mail via Email Client, then in the script step for Export Field Contents, you do not need the "Create email with file as attachment" selected. The idea is:

                        1) Set variables for path, filename and full path.

                        2) Export the file (without creating email).

                        3) Use the Send mail script step, with Email Client selected and "Perform without dialog" deselected, to create the email with file attached ready for the user to enter subject and message and whatever else.

                         

                        Is that what you need?

                         

                        R

                        1 of 1 people found this helpful
                        • 9. Re: Email a Saved Open Storage Document
                          MarkNZ

                          Yes that all works now...there is a we blip that happens just before the email appears..I thinks its to do with the file being exported just before the email? aprt from that is works fine

                           

                          cheers Rob