5 Replies Latest reply on Jan 6, 2011 2:53 PM by philmodjunk

    Save as pdf and attach to mail.

    RitteT

      Title

      Save as pdf and attach to mail.

      Post

      Hi again.

      Thanks for the previous help.

      Now I'm trying to make a script that saves the current record as pdf and opens a mail with the pdf attached.

      My script looks like this:

      Set variable[$filename; Value:"file" & Get(skrivbordssökväg) & Anställd::Kundnummer]

      Printer layout [restore, no dialogbox]

      Send email [send by client; To:: Anställd::Email; Ämne: "Värdering"; "$filnamn].

      I want to auto-generate a name to the pdf-file based on customernumber and then attach this pdf to a new mail, for every record.

      I've two problems, I can't auto-generate filenames. I get "$filnamn" with the script above.

      The second problem is attaching to the mail. Even if choose the script "send as mail" (default in FM), and choose which file I get a new mail without attachment.

      Need some advice.

        • 1. Re: Save as pdf and attach to mail.
          philmodjunk

          Hmmm,

          Don't see the purpose for Printer Layout (Printer Setup in English?) coming where it does in the script.

          Has the PDF already been created before this script runs? I don't see any Save as PDF step here.

          In your Send Mail script step, make sure that you have "$FileName" and only see one set of quotes. If you have ""$filename"", then re-open the send mail dialog for this step and remove the quotation marks.

          • 2. Re: Save as pdf and attach to mail.
            RitteT

            I solved it with your old post:

            http://forums.filemaker.com/posts/aaa462fda5

            Thanks! :)

            • 3. Re: Save as pdf and attach to mail.
              Sorbsbuster

              ...and don't copy the typing error:

              Set variable[$filename;...

              versus

              Send email [send by client; To:: Anställd::Email; Ämne: "Värdering";  "$filnamn].

              • 4. Re: Save as pdf and attach to mail.
                RitteT

                Thanks, it's solved.

                In my mail I've written a text to the customer (via the script).

                Is it possible to include the customer's name in the mail like:

                "Hi <<name>>, thanks for your purchase. Here is your ticket"

                Right now I use:

                "Hi, thanks for your purchase. Here is your ticket"

                • 5. Re: Save as pdf and attach to mail.
                  philmodjunk

                  When you specify the Body in your Send Mail dialog, one options is to use a calculation. It can be written like this:

                  "Hi " & Yourtable::namefield & ", thanks for your purchase. Here is your ticket."

                  You can also use the substitute function, in several different ways which can make for a more flexible approach:

                  Subsitute ( TextField ; "<<name>>" ; YourTable::namefield )

                  This way, you can put "Hi <<name>>, thanks for your purchase. Here is your ticket." in the text field, but have the substitute function replace any instances of <<name>> with the current record's name field. This allows you to have several different messages typed into different text fields and/or different records and you can personalize all of them with the same basic calculation.