Native HTML Email in FileMaker 18

Email is one of the simplest tools used to communicate and send information. Just open a mail client, write a message and press a button to virtually send a letter or message to a recipient.

Sometimes, in addition to simple text, we want to enrich our emails with graphical contents and attachments, making it more pleasant for those who receive it or giving a more cohesive image to our brand. This requires HTML, and it’s not as simple to build and send emails this way.

FileMaker 18 has introduced a built-in way to send email in HTML format, using SMTP protocols. I’ll cover what this means, how to use this new functionality, and use FileMaker 18 to send basic HTML email that looks like this:

In FileMaker 17, without plugins, it was only possible to send email in plain text format, using the SMTP server sending options that were available in the “Send Mail” instruction.

Now, with the new version FileMaker 18, the set of protocols available in the “InsertFromURL” instruction has been enriched by adding the SMTP and SMTPS protocols (among others).

The new protocols supported by the “InsertFromURL” instruction will, therefore, allow you to interact differently with an SMTP server by extending what was previously not possible with the “Send Mail” command: sending e-mails in HTML format.

To create an email that respects these characteristics, it is necessary to respect some rules of composition of the message that you want to send via “InsertFromURL” (using FileMaker).

The email or the body of the call must be composed following the MIME-Version 1.0 standard. To help you better understand how to implement it, I’ll explain in detail below.


In this brief guide, I will not explain how to style an email template using HTML. Elsewhere, online, you can surely find many ideas on how to design an excellent and attractive e-mail template.

The only advice I’d like to give you is to insert the images used in the composition of your template directly into the body of the mail (using base64 encoding):


Template Mail

First of all, it is necessary to prepare a textual model of the body of our email with some placeholders {{value}} which we will replace dynamically before sending.

Attention! This is not the real email that the user sees, but a series of instructions that will be interpreted by our SMTP server to correctly send the email to the recipient.


Sender, recipient and subject

In the first lines of our model, we will have to replace the placeholders with the information of the sender and who should receive the email.

To make it simple, I will use the calculation “Substitute” to which I will transfer my variables ($fromName, $from, $to, $cc and $subject:



Among the headers of our model we have to insert the following information:

Important: the value of {{hash}} must be generated at the beginning and then replaced in all parts of our template. In this case, I used the following formula to generate a unique random string for my e-mail ($hash):

And as previously indicated, I used the “Substitute” command to dynamically replace its value:



In the body of our model, we can now insert the real body of our email, as well as every attachment and every structure we want to send.

To correctly enter this information we must respect the following logic:


For HTML content:

The initial statement — {{hash}} indicates a new block of content that follows a specific content type (in this case text/html) and a transfer method (base64).

The value of {{HTMLMessage}}, will be the real email template in HTML format.

As always, it will use the “Substitute” command to dynamically replace its value within our model:

Note: for the HTML body I chose to base its content on base64!


For the attachments:

The initial instruction — {{hash}} indicates a new block of content that follows a specific content type (in this case it has to be determined based on the type of file we are attaching), a transfer method (base64), the name of the file being sent and finally our file {{attachment}}.

As always I will use the “Substitute” command to dynamically replace its value within our model:

Note: for the attachment I have again chosen to base its content in base64!

To get the file name, I used the statement:

To obtain the related mime-type I have created a pair of custom functions (GetMimeType and GetFileExtension) that help to get the correct value in relation to the extension of the file that you want to attach.

Repeat these steps described above for each attachment that you want to insert in the e-mail (use a “Loop” to simplify this activity).



To complete our model, just insert a simple final instruction (note the opening and closing characters -):

And again, I have used the “Substitute” command to dynamically replace its value:


Template ready to use

Et voila! The result of the model with all the values replaced will have a structure similar to the one you see below (with the expected parts, replaced by our FileMaker script).

In this test, in addition to the body of the email in HTML format, I have attached 4 files: a text document, an excel file, a zip archive, and an image.


Now… send the e-mail

The last important step that remains before we can send our email is to configure the SMTP options provided by our email provider.

Since the email must be sent via “InsertFromURL” it is necessary to configure the cURL options needed for the correct routing of the message:

Also in this case I dynamically replaced the indispensable values to send the email.

Important to note are the –mail-from and –mail-rcpt flags (which can be repeated if you want to insert a list of recipients) and the –user flag containing the authentication credentials to our SMTP server.

Our model ($message) will instead be managed with the flag –upload-file

Note: In the “InsertFromURL” instruction, you must indicate as the URL the complete address of our mail server including protocol and port, but in our case we use a communication based on SSL, so the protocol chosen is SMTPS and port 456.



Thanks to the new protocol supported by the new version of FileMaker 18, it is now possible to send emails (with few tricks) directly from our applications, in order to make communications to customers more attractive and impactful.


One more thing

Do you know that this new feature, combined with the Data API, allows you to create a new mode of iteration between you and your customers? Imagine an email in HTML format with a link that calls a WebService that uses the Data API to trigger an event or create a record in your database … A typical case is the submission of a report which asks your customer to give a confirmation – now you just need one click in your summary email to allow the customer to do this quickly and easily.


If something is not clear in this brief guide, download the attached file I created to help you practice.


Leave a Reply