Skip to main content
SaaS Starter Vue uses Laravel’s mail system to send transactional emails including registration confirmations, password resets, subscription notifications, and tenant invitations.

Email Drivers

Laravel supports multiple email delivery methods:
  • SMTP - Standard SMTP server (Gmail, Mailgun, etc.)
  • Mailgun - Mailgun API integration
  • Postmark - Postmark API integration
  • Amazon SES - AWS Simple Email Service
  • Resend - Resend API integration
  • Log - Write emails to log files (development only)
  • Array - Store emails in memory (testing only)
The application defaults to the log driver for development. Configure a real mail driver for production.

SMTP Configuration

The most common email configuration uses SMTP:

Environment Variables

string
default:"log"
The default mail driver. Set to smtp for SMTP delivery.
string
default:"127.0.0.1"
required
The SMTP server hostname.
integer
default:"2525"
required
The SMTP server port. Common ports:
  • 25 - Standard SMTP (usually blocked by ISPs)
  • 587 - TLS/STARTTLS (recommended)
  • 465 - SSL
  • 2525 - Alternative port (Mailgun, Mailtrap)
string
SMTP authentication username.
string
SMTP authentication password.
Store this securely. Never commit to version control.
string
Encryption method. Options: tls, ssl, or leave empty for no encryption.
Use tls for port 587, ssl for port 465.
string
default:"hello@example.com"
required
The default “from” email address for all outgoing emails.
string
default:"${APP_NAME}"
The default “from” name for all outgoing emails. Supports variable substitution.

Provider-Specific Configuration

Gmail

Using Gmail for SMTP (not recommended for production):
Gmail requires an App Password (not your regular password). Enable 2FA and create an app password at: https://myaccount.google.com/apppasswords

Mailgun

Professional email delivery service:

Mailtrap (Development)

Email testing service for development:
Mailtrap captures all emails without delivering them. Perfect for testing email functionality.

Postmark

Transactional email service with high deliverability:

Amazon SES

AWS Simple Email Service:

Resend

Modern email API:

Development Configuration

For local development, use the log driver to preview emails:
.env
Emails will be written to storage/logs/laravel.log:

Testing Email Configuration

Test your email configuration:

Email Types Sent by the Application

The application sends various transactional emails:

Authentication Emails

  • Email Verification - Sent when new users register
  • Password Reset - Sent when users request password reset
  • Two-Factor Authentication - 2FA codes if enabled

Tenant Management Emails

  • Tenant Created - Welcome email for new tenants
  • User Invitation - Invite users to join a tenant
  • Role Changed - Notification when user role changes

Subscription Emails

  • Subscription Created - Confirmation of new subscription
  • Subscription Renewed - Renewal confirmation
  • Subscription Canceled - Cancellation confirmation
  • Payment Failed - Notification of failed payment
  • Trial Ending Soon - Reminder before trial expires

System Notifications

  • Activity Alerts - Important system activity
  • Security Alerts - Suspicious login attempts
  • System Updates - Maintenance notifications

Customizing Email Templates

Email templates are located in resources/views/emails/:

Email Queuing

For better performance, queue emails instead of sending synchronously:
Ensure your queue is configured:
.env
Run the queue worker:
In production, use a process manager like Supervisor to keep the queue worker running.

Advanced Configuration

Multiple Mail Configurations

Use different mail configurations for different email types:
Send via specific mailer:

Failover Configuration

Automatically fallback to another mailer if the primary fails:
.env

Per-Tenant Email Configuration

Configure different email settings per tenant:

Production Best Practices

Domain Authentication Required: Configure SPF, DKIM, and DMARC records for your sending domain to ensure deliverability.

SPF Record

Add to your DNS:

DKIM Record

Obtain from your email provider and add to DNS.

DMARC Record

Rate Limiting

Implement rate limiting to prevent abuse:

Email Verification

Ensure your email sender identity is verified with your provider.

Monitoring

  • Track email delivery rates
  • Monitor bounce rates
  • Set up alerts for failed deliveries
  • Log all email sending attempts

Troubleshooting

Emails Not Sending

Connection Timeout

  • Verify SMTP host and port
  • Check firewall rules
  • Ensure the port is not blocked by your hosting provider

Authentication Failed

  • Verify username and password
  • Check if 2FA/app passwords are required
  • Ensure SMTP authentication is enabled

Emails Going to Spam

  • Configure SPF, DKIM, and DMARC
  • Use a reputable email service
  • Avoid spam trigger words
  • Include unsubscribe links
  • Maintain a good sender reputation

Environment Examples

Next Steps