Emails
Sending emails with Mailjet’s API and avoiding the spam folder
Setup
For emails, we’re using Mailjet. They provide an extremely generous free tier so you won’t have to pay a dime for your MVP.
Register
Head over to Mailjet and create an account (choose the free plan).
Get API Keys
Navigate to the API page and generate a secret key. Paste the API Key and Secret Key in your .env
file.
Usage
You can use Mailjet to send emails programatically throughout your app. There is a usage demo in that you can reference in src/routes/api/mailjet
. Click here to view the docs.
Avoid the spam folder
To avoid having your emails go into spam, you will need authenticate your domain.
Add domain or sender address
Navigate to Mailjet and add a domain or sender address. Follow the steps to validate.
SPF/DKIM Setup
Go to the SPF/DKIM Authentication section, hit the cogwheel next to your domain and then click setup.
Add Records
Your email service provider will have an admin panel where you can create and edit the SPF and DKIM records. Generally, you will need to create a new DKIM and edit the old SPF to include include:spf.mailjet.com
.