Tim Dietrich

Custom Software Developer

Home Services Portfolio Blog About Contact Newsletter

FileMaker: Send Emails And Text Messages Without Plugins

Sending email messages from FileMaker, and especially nicely formatted HTML email messages, has been a challenge for quite awhile. There are FileMaker plugins available that help with this, and in the past I've used some of those plugins myself.

However, recently I've been using a different approach. It involves using Mandrill, an email platform that is provided by the same folks that provide the popular MailChimp email marketing service.

Why Mandrill?

With Mandrill, you can send up to 12,000 emails per month for free (no kidding). To send additional emails, you pay around $0.20 per thousand messages. (Details are here: https://www.mandrill.com/pricing/ )

But what really makes Mandrill ideal is that you can send messages through the service using what is known as a RESTful API. As a result, we can use FileMaker's "Insert From URL" script step to send messages through Mandrill.

Using "Insert From URL"

The trick to making this work is using a properly-formatted URL with the "Insert From URL" script step. Here's a very basic example of a properly formatted URL:

httpspost://mandrillapp.com/api/1.0/messages/send.json?key=APIKEY&message[html]=<p>This is a test message with <span style="font-weight: bold;">some HTML</span> & more stuff.</p>&message[subject]=Test Message&message[from_email]=johndoe@test.com&message[from_name]=John Doe&message[to][1][email]=timdietrich@mac.com

In this example, a message with subject "Test Message" will be sent to "timdietrich@mac.com." It will appear to come from someone named "John Doe" with email address "johndoe@test.com."

Notice that the URL starts with "httpspost," which tells FileMaker to POST the request over HTTPS.

Also note that the URL contains a Mandrill API Key (APIKEY). You can get your own key by signing up for Mandrill here: https://mandrill.com/signup/

And that's really all that there is to sending an email message from FileMaker. The technique works with solutions running on FileMaker Pro, Go, WebDirect, or as a script running on FileMaker Server.

Mandrill's API provides a lot more functionality than I'm describing here. For example, you can use Mandrill to send file attachments, to track message openings, clicks, and more. And in the example above, we're only sending the message to a single recipient. However, you can use Mandrill message to send "blast" messages out to multiple addresses at one time. You can learn more about the API here: https://mandrillapp.com/docs/

Sending Text Messages

I have also been using Mandrill to send text messages. Well, sort of. What I'm really doing is sending messages through Mandrill to SMS gateway addresses. An SMS gateway address is simply an email address that maps to a mobile phone number. Nearly all carriers in the United States provide these addresses. (You might run into problems if you try to send a message to mobile users outside of the United States, however.)

For example, suppose that you want to send a text message to 804-555-5555, and you know that the carrier for that mobile phone is AT&T. The SMS gateway address would be: 8045555555@txt.att.net Sending an email to that address will result in the message arriving on the user's mobile phone as a text message. I've put together a pretty thorough list of SMS Gateways here: http://timdietrich.me/fmauthenticator/sms-gateways.php

So again, to send a text message from a FileMaker solution through Mandrill, you would do so by sending to a user's SMS gateway address. The only catch, of course, is that you need to know the user's carrier ahead of time.

Demo Database

To help you get started using Mandrill with FileMaker, I've put together a very basic demo database. To use it, just add your own Mandrill API key to the script. Again, this is very basic. The demo file is available here, and it is fully unlocked.

If you give it a try, please let me know what you think.