Send Mail via SMTP using Insert from URL

Expert

Send transactional email from FileMaker scripts by calling an SMTP relay API with Insert from URL, avoiding the native Send Mail step's client dependency.

What you'll learn

  • Why Insert from URL is preferred over the native Send Mail step for automated email
  • How to build the API request body for a transactional email service
  • How to pass authentication credentials securely
  • How to handle rate limits and delivery errors
  • How to log sent emails to an audit table

FileMaker's native Send Mail step opens the user's local email client, which is unsuitable for server-side automation or solutions where the client machine may not have email configured. Calling an SMTP relay service (such as SendGrid, Mailgun, or a self-hosted relay) via Insert from URL gives you server-sendable, logged, reliable email delivery with full control over headers, recipients, and content.

1/3
1

Build the email API request payload

Most transactional email APIs accept a JSON body with to, from, subject, and content fields. Build the payload with JSONSetElement, keeping the API key in a $$global loaded from an encrypted settings record rather than hard-coded.

FileMaker Script
Set Variable [ $toEmail ; Value: Contacts::Email ]
Set Variable [ $subject ; Value: "Your invoice is ready: " & Invoices::InvoiceNumber ]
Set Variable [ $htmlBody ; Value:
  "<p>Dear " & Contacts::FirstName & ",</p>" &
  "<p>Invoice " & Invoices::InvoiceNumber & " for " &
  "$" & Invoices::Total & " is attached.</p>"
]

Set Variable [ $payload ; Value:
  JSONSetElement ( "{}" ;
    [ "from" ; "billing@example.com" ; JSONString ] ;
    [ "to" ; $toEmail ; JSONString ] ;
    [ "subject" ; $subject ; JSONString ] ;
    [ "html" ; $htmlBody ; JSONString ]
  )
]

Sign in to track your progress and pick up where you left off.

Sign in to FM Dojo