Installation & Configuration
Learn how to install and configure the Nuxt Email Layer in your project with different email providers.
Installation
Install the email layer as a dependency in your Nuxt project:
Basic Setup
Add the email layer to your Nuxt configuration:
That's it! The layer will work out of the box with the default MailCatcher provider for development.
Runtime Configuration
Configure email providers and settings using Nuxt's runtime configuration:
Environment Variables
For production usage with Mailgun, set these environment variables:
Provider Configuration
MailCatcher (Development)
MailCatcher is perfect for development and testing. It catches emails instead of sending them, allowing you to review them in the devtools.
Features:
- ๐ง Catches all emails without sending them
- ๐ Review emails in the devtools interface
- ๐พ Stores emails in filesystem storage
- ๐ Zero external dependencies
Mailgun (Production)
Mailgun is a reliable email service for production applications:
Requirements:
- Mailgun account and API key
- Verified domain
- API key with sending permissions
Development Tools
The email layer includes development tools that are automatically enabled in development mode:
Accessing the Email Devtools
When running in development mode, visit:
Or use the Emails tab in the Nuxt Devtools.
The devtools provide:
- ๐ง Email inbox for reviewing caught emails
- ๐งช Test email sending functionality
- ๐ Email content preview
- ๐๏ธ Clear email history
Configuration Options
Core Settings
| Option | Type | Default | Description |
|---|---|---|---|
provider | string | 'mailcatcher' | Email provider to use |
defaultFrom | string | 'hello@world.com' | Default sender email address |
MailCatcher Settings
| Option | Type | Default | Description |
|---|---|---|---|
storageKey | string | 'mailcatcher' | Storage key for caught emails |
Mailgun Settings
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | '' | Mailgun API key |
domain | string | '' | Mailgun domain |
Environment-Specific Configuration
Configure different providers for different environments:
Verifying Installation
Create a test API endpoint to verify your installation:
Visit /api/test-email to test your configuration. Check the devtools at /__email-devtools to see the caught email.
Next Steps
Now that you have the layer installed and configured:
- Learn how to send emails with the
useEmail()composable - Explore email templates and Vue Email components
- Configure email providers for your specific needs
- Use the devtools for testing and debugging