October 17, 2024
O. Wolfson
This article provides a step-by-step guide on setting up a custom SMTP server with Supabase and Resend to send authenticated emails from your domain. You'll learn how to configure SMTP settings, verify your domain, and set up the necessary DNS records, including SPF, DKIM, and DMARC, ensuring secure and reliable email delivery for your application.
SMTP (Simple Mail Transfer Protocol) is a protocol used for sending and relaying emails across the internet. It ensures that emails from your server are properly sent and authenticated to reach the recipient’s inbox. SMTP servers manage email authentication, queuing, and delivery to ensure messages are delivered correctly.
When using a custom domain (e.g., yourdomain.com) for sending emails, DNS records are critical for routing, verifying, and securing your email communications. The key DNS records are:
Create an account on Resend or your chosen email service provider.
Add your domain to Resend and configure DNS settings. Resend will provide the necessary DNS records for verification:
Add the DNS records to your DNS provider (such as Vercel, Cloudflare, etc.). For example:
txtName: resend._domainkey Type: TXT Value: <DKIM Public Key> TTL: 60
Wait for DNS propagation (this can take several minutes to hours). Once the records propagate, Resend will verify the domain.
Once the domain is verified, note the following SMTP details:
smtp.resend.comAccess your Supabase dashboard and go to the Authentication section.
Under the Email or Custom SMTP tab, input the following details:
smtp.resend.comteam@yourdomain.comSave and encrypt your SMTP credentials (handled automatically by Supabase).
By following these steps, you can successfully set up custom SMTP with Supabase and Resend. With the proper DNS records (SPF, DKIM, and MX) and domain verification, your emails will be authenticated, ensuring higher deliverability and security. This setup allows for professional, branded email communication for your application.