Skip to main content

Send SMTP Emails with SendGrid

This page describes how to use SendGrid as an SMTP Relay to send emails from Fanoni.

note

SMTP email is only available when self-hosting Fanoni.

Fanoni's hosted environment uses Amazon Simple Email Service (SES). Amazon SES is the default Fanoni email provider.

Prerequisites

Be sure to perform the following prerequisites to complete this tutorial.

  1. Sign up for a SendGrid account
  2. Create and store a SendGrid API key with full access "Mail Send" permissions.
  3. Verify your SendGrid Sender Identity

See the SendGrid How to Send an SMTP Email guide for step by step instructions.

Configuring Fanoni Server for SMTP

Open your Fanoni server config file. When developing on localhost, the default config file location is packages/server/medplum.config.json.

Change the supportEmail to your Sender Identity email address:

"supportEmail": "support@example.com",

Add a new smtp section for the SendGrid SMTP settings. Use your API key as the SMTP password:

"smtp": {
"host": "smtp.sendgrid.net",
"port": 587,
"username": "apikey",
"password": "YOUR_API_KEY"
}

Testing

Once your configuration settings are saved, restart the Fanoni server. All subsequent emails will be sent via SendGrid SMTP Relay. For example, you can invite a new user or reset your password to send a new email.

tip

If your SendGrid account is new, email delivery may be slow for the first 24 hours.