SMTP
Generic SMTP Configuration
Connect any SMTP provider
Use any SMTP provider with LaravelSMTP by configuring custom SMTP settings. Perfect for enterprise servers, hosting providers, or services not directly supported.
Basic Configuration (.env)
# LaravelSMTP Generic SMTP Configuration
LSMTP_PROVIDER=smtp
LSMTP_FROM_ADDRESS=no-reply@yourdomain.com
LSMTP_FROM_NAME="Your App Name"
# SMTP Server Settings
SMTP_HOST=smtp.your-provider.com
SMTP_PORT=587
SMTP_USERNAME=your-username
SMTP_PASSWORD=your-password
SMTP_ENCRYPTION=tls
Ports
- • 587 — STARTTLS (recommended)
- • 465 — SSL/TLS
- • 25 — Unencrypted (not recommended)
Encryption
- • tls — STARTTLS
- • ssl — SSL/TLS
- • null — No encryption
Common Providers
Office 365 / Outlook
SMTP_HOST=smtp.office365.com
SMTP_PORT=587
SMTP_ENCRYPTION=tls
Yahoo Mail
SMTP_HOST=smtp.mail.yahoo.com
SMTP_PORT=587
SMTP_ENCRYPTION=tls
cPanel Hosting
SMTP_HOST=mail.yourdomain.com
SMTP_PORT=465
SMTP_ENCRYPTION=ssl
Other Providers
SMTP_HOST=smtp.provider.com
SMTP_PORT=587
SMTP_ENCRYPTION=tls
Advanced Options
# Timeout settings (seconds)
SMTP_TIMEOUT=30
SMTP_CONNECTION_TIMEOUT=60
# Local hostname for SMTP HELO
SMTP_LOCAL_DOMAIN=yourdomain.com
# Keep connection alive
SMTP_KEEPALIVE=true
# TLS verification
SMTP_VERIFY_PEER=true
SMTP_VERIFY_PEER_NAME=true
Authentication Methods
Username/Password (Most Common)
SMTP_USERNAME=your-email@domain.com
SMTP_PASSWORD=your-app-password
OAuth2 (Advanced)
SMTP_AUTH_TYPE=oauth2
SMTP_OAUTH_CLIENT_ID=your-client-id
SMTP_OAUTH_CLIENT_SECRET=your-client-secret
SMTP_OAUTH_REFRESH_TOKEN=your-refresh-token
Test your setup
php artisan laravelsmtp:test recipient@domain.com
php artisan laravelsmtp:doctor