Have you been thinking of sending HTML Emails from FileMaker with multiple attachments? Here is how you can do it…
Many of us are aware of “Send Email” script step in FileMaker to send out text formatted emails. Filemaker “Send Email” script step can only attach one attachment to each email if you are on FileMaker versions 16 or older. After ages, we can now attach multiple attachments in FileMaker 17, but we are still held back with sending HTML Emails from FileMaker. HTML formatted emails are way more attractive to recipients and allow us to add incredible features like buttons with hyperlinks, embedded images in email’s body and many more…
With FileMaker HTML Emailer we can now send HTML Emails from FileMaker by employing a few custom functions a and a very well known free plugin called BaseElements from Goya.com . Base elements plugin has lots of awesome functions and it is available to us for free of charge. I would highly recommend you to subscribe to their plugin sponsorship program . You will get access to the plugin support while helping Goya people to cover their costs and keep the plugin up in the community for free.
This file sends HTML Emails from FileMaker with following cool features:
- Multiple recipients
- CSS styling (Users can add any styles to email body text using FileMaker text styling bar and it will be translated to HTML inline CSS styles)
- Supports multiple attachments (Drag and Drop)
- Create and edit predefined email templates with support of multiple attachments
- Both server and client compatible (Mac and Windows)
- Template buttons to input predefined variables such as current date, recipient name, etc.
- Add creative and cool looking buttons to email body (Hyperlinks)
- Email sent status for each recipients
- Send test email to any given email address to double check the email formatting
The file can easily integrate with your solution, all you need is to add it as an external source to your file and call its script from your existing solution or you can copy and paste the tables, scripts and layouts to your FileMaker file. It is a completely open file and it is available for free to you to experiment with it. You may also add more options such as “CC” or “BCC”, etc emails as you wish.
You would need to setup your SMTP server setting on:
- Line 40 of SendEmailClientSide script
- Line 13 of SendEmail (PSOS) script
- Line 40 of SendTESTEmail script
#Tip: If you have access to developer tools on FileMaker advanced, then you can setup SMTP server settings as a custom function and use it in scripts.
If you decided to inject the file into your own solution, then you need to:
- Copy or create all existing tables of the original file into your solution and setup relationships to match its graph.
- Copy “Emails” script folder with all it’s scripts and paste it into your solution.
- Create the same layouts as the original file in your FileMaker solution and then copy and paste relevant layout objects from HTML Emailer file into them.
- Then set up your SMTP server configurations as explained above.
- BaseElements plugin, version 3.3.7 or above
- FileMaker 14 and above (Button bars are used in this file, if you decide to use it with older versions, you need to replace them with normal buttons but, take note that normal buttons do not accept calculations or variables as button text so, you will need to hard code them)
- A few custom functions (please refer to manage custom functions)
Here, you can find links to custom functions used in this solution to format and send HTML Emails from FileMaker (Some are optional and some are required):
- Required custom function:
This function is used to convert email text to html format.
Above custom function translates FileMaker native text formatting into inline CSS styles.
- Optional custom functions:
These Custom functions are used in SQL queries to always provide true formated field and table names. By using these, you won’t need to hard code field names and table names so, your SQL queries will never break by renaming fields or tables. (Optional)
It is used to format numbers to currency format in HTML text. (Optional)
To make sure that the email input is in correct format. (Optional)
These custom functions are provided with a sample file from Goya.com to generate true system paths to be used with their plugin. (Optional)
You can download the FileMaker HTML Emailer from here.
Hopefully you will find this article useful. Please spread the word if you think it can help other developers too!
I am open to any comment or advise to improve the file.