Markdown

Connections and services

Setting up email delivery with SendGrid

You create an API key at SendGrid, store it under Connections, and then monitor status and authenticated domains directly in MainPath.

On this page

SendGrid is integrated into MainPath as its own connection type. You store only an API key; MainPath handles sending through SMTP (smtp.sendgrid.net, user apikey), the status display, and the monitoring of your authenticated domains.

flowchart LR
  cred["Organization's SendGrid connection"]
  svc["Your project's backend"]
  api["SendGrid API / SMTP"]
  mx["Recipient's mail server"]
  svc -->|"reads credentials"| cred
  svc -->|"API key"| api
  api --> mx

For a different provider, create a generic Email (SMTP) connection instead; Email delivery describes the differences.

Preparing at SendGrid

  1. Create an account at sendgrid.com or sign in.
  2. Under Settings → Sender Authentication, add your sender domain and set the displayed DNS records for SPF, DKIM, and DMARC at your domain provider; sending is only enabled after verification. You can also take care of this step later from within MainPath.
  3. Under Settings → API Keys, create a key with Mail Send and domain authentication rights, then copy it.

The same API key is used as the SMTP password. The SMTP user is always apikey.

Creating the connection in MainPath

  1. Open Connections in the sidebar and click Add connection.
  2. Choose the SendGrid tile.
  3. Enter the API key, optionally with a sender name and a sender address from your authenticated domain.
  4. Save. The connection is then available in projects under Mail account.

Monitoring status and domains in MainPath

The SendGrid connection’s tile opens its detail view with the status of the connection, your authenticated domains with their verification status, and for each domain the DNS records with type, name, value, and check status. With Add domain you create new sending domains right here.

Selecting the mail account in the project

When editing the project, select the SendGrid connection under Mail account in the backend’s settings. SendGrid, Resend, Mailtrap, and SMTP connections are listed there together.

If something does not work

If the status shows an error, check the API key and create a new one at SendGrid if necessary. If SendGrid rejects sending or mail does not arrive, the domain is usually not authenticated yet; compare the DNS records in the detail view with those at your domain provider. If a domain is missing from the list, create it with Add domain and set the displayed records.

See also