Docs / Email Servers / How to Configure Email Relay with SendGrid

How to Configure Email Relay with SendGrid

By Admin · Mar 1, 2026 · Updated Apr 25, 2026 · 30 views · 2 min read

Why Use an Email Relay?

Sending email directly from a Breeze can result in deliverability issues due to shared IP reputation. Configuring an SMTP relay service ensures your transactional and notification emails reach recipients' inboxes reliably while offloading reputation management.

Prerequisites

  • A Breeze running Ubuntu 22.04+ with Postfix installed
  • A SendGrid account with an API key

Step 1: Install Required Packages

sudo apt update
sudo apt install postfix libsasl2-modules

During Postfix installation, select Internet Site and enter your domain name.

Step 2: Configure Postfix for Relay

sudo nano /etc/postfix/main.cf

Add or update these directives:

relayhost = [smtp.sendgrid.net]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000

Step 3: Set Up Authentication

sudo nano /etc/postfix/sasl_passwd
[smtp.sendgrid.net]:587 apikey:YOUR_SENDGRID_API_KEY
sudo postmap /etc/postfix/sasl_passwd
sudo chmod 600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db

Step 4: Restart and Test

sudo systemctl restart postfix
echo "Relay test from Breeze" | mail -s "Test Email" you@example.com

Check the mail log for confirmation:

sudo tail -f /var/log/mail.log

DNS Configuration

  • Add the SPF record: v=spf1 include:sendgrid.net ~all
  • Complete domain authentication in the SendGrid dashboard for DKIM
  • Set up a DMARC record to monitor delivery alignment

Tips

  • Use a dedicated API key with only Mail Send permissions
  • Monitor delivery metrics in the SendGrid activity feed
  • Rotate API keys periodically for security on your Breeze

Was this article helpful?