Email Service Tutorial
Learn how to use the email service in your ZapStart application
Overview
ZapStart includes a pre-configured email function sendEmail
in the backend/src/libs/mailgun.js
file that makes it easy to send transactional emails from your application.
The email service uses Mailgun as the delivery provider, but the implementation is abstracted so you can easily switch providers if needed.
If you haven't configured your Mailgun API key, make sure to follow the Email Configuration documentation for more details.
Examples
Subscription/Payment Confirmation Email
You can find an example of the sendEmail
function in the subscription controller. This example shows how to send a confirmation email when a user subscribes to a plan:
To use this example, simply uncomment the email sending code in your backend/src/controllers/subscriptionController.js
file and make sure your Mailgun API key is properly configured in your .env
file.
Always test your email implementation thoroughly before deploying to production. Many email providers have strict anti-spam policies that might affect deliverability.