GM
Gmail & Google Workspace
Secure OAuth2 email delivery
Use Gmail or Google Workspace for sending emails with OAuth2 authentication. Perfect for small to medium applications that need reliable delivery with Google's infrastructure.
OAuth2 Setup
- Go to Google Cloud Console
- Create a project and enable the Gmail API
- Create OAuth 2.0 Client ID (Web application)
- Add redirect URI: https://yourdomain.com/gmail/callback
Tip: For local dev, you can use http://localhost:8000/gmail/callback
.env configuration
# LaravelSMTP Gmail Configuration
LSMTP_PROVIDER=gmail
LSMTP_FROM_ADDRESS=your-email@gmail.com
LSMTP_FROM_NAME="Your App Name"
# Google OAuth Credentials
GOOGLE_CLIENT_ID=your-client-id.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=https://yourdomain.com/gmail/callback
Authorize your application
php artisan laravelsmtp:authorize gmail
This opens a browser to sign in and grant permission. Tokens are saved and auto-refreshed.