Email Sending
This guide explains how to use the integrated email sender and how you can integrate your own account in this template.
Sending Emails
The Dummy
Email Provider (for Local Dev Only)
By default we’ve set up the email sender to use the Dummy
provider. This is for local development only and no emails will actually be sent out!
To obtain an email verification token/link, you must check the server logs on initial sign up. You can click this link to verify your email and continue with the sign up process.
Note that your app will not build if using the Dummy
provider and you must switch to a production-ready provider in order to do so.
Using a Production-Ready Email Provider (e.g. SendGrid)
To change your email provider to a production-ready one, such as SendGrid, you’ll want to configure your emailSender
like so:
This means that you can send emails from your app using the send
function from the email
modul provided by Wasp:
In the example above, you can see that we’re sending an email to the customer when we receive a cancel subscription event within the Stripe webhook.
This is a powerful feature and super simple to use.
Integrate your email sender
To set up your email sender, you first need an account with one of the supported email providers.
- Register at SendGrid.com and then get your API KEYS.
- Copy yours to the
.env.server
file under theSENDGRID_API_KEY
variable.
Make sure to change the defaultFrom
email address in the main.wasp
file to use the same email address that you configured your account to send out emails with!
- Go to Mailgun and create an account.
- Go to API Keys and create a new API key.
- Copy the API key and add it to your .env.server file under the
MAILGUN_API_KEY=
variable. - Go to Domains and create a new domain.
- Copy the domain and add it to your .env.server file as
MAILGUN_DOMAIN=
.
Make sure to change the defaultFrom
email address in the main.wasp
file to use the same email address that you configured your account to send out emails with!
If you want more detailed info, or would like to use SMTP, check out the Wasp docs.