4 Replies Latest reply on Jul 7, 2010 8:51 AM by philmodjunk

    Attaching images to emails

    silba2021

      Title

      Attaching images to emails

      Post

      Hi,

      I have a container field that I have put images into, I have also set up an email button with a script to send email via email client. The filepath to these images are not the same and change with every email I send out. I know I can set up the script (Send Mail) to send the same file from the same location but how can I vary this. Perhaps there is some way of getting the image filepath from the container field?

      Also, in my email script is it possible to fill the CC  field with multiple/all emails from an email field. Thanks in advance.

        • 1. Re: Attaching images to emails
          conor

          Assuming you are storing references to the file and not storing the file in the container itself:

          From the FileMaker help: Tip  If you select Store only a reference to the file, one way to see the  location of the file on your hard disk is to create a script using the  Get(ActiveFieldContents) function.

          I have found that a simple GetAsText ( ContainerField ) will give you enough to work out the file path.

          Cheers,

          Conor.

          • 2. Re: Attaching images to emails
            philmodjunk

            You can also use export field contents to export a copy of the file to your temporary folder and attach that file to your email.

            • 3. Re: Attaching images to emails
              silba2021

              Thanks Conor, Phil,

              I was planning to embed the image into the filemaker file but looks like Phil's suggestion would mean that the exported file would have to have the same default name each time for the attachment to work. So I am leaning towards your solution of storing it as a reference, that way I can maintain the image file naming conventions we have. If I am making some wrong assumptions here please let me know.

              Any input on how to add multiple emails to the CC email field?

              • 4. Re: Attaching images to emails
                philmodjunk

                There are ways to specify any filename you need when you export the field contents.

                As to putting multiple email addresses in the CC box, the details depend on your email software and how your multiple emails are stored in your database.

                You can build a string of emails in this format: email1, email2, email3 or this format email1; email2; email3
                depending on what your email software requires. How you build this list depends on the design of your database solution. If the email addresses reside in a group of records that are related to the current record, you could simply use a version of this calculation:

                Substitute ( List ( relatedTable::Email ) ; ¶ ; "; " )

                In other cases, you may need to loop through a set of records appending one more email to such a list with each pass through the loop.