This guide will help you configure SMTP to send real emails from your Malify email client.
Your Malify email client now includes:
- β Real Email Sending: Send emails to any email address
- β Multiple SMTP Providers: Support for Gmail, Outlook, Yahoo, and custom SMTP
- β SMTP Testing: Built-in connection and email testing
- β Error Handling: Graceful fallback to drafts if SMTP fails
- β Message Tracking: Track sent emails with message IDs
- Go to Google Account Settings
- Enable 2-Factor Authentication if not already enabled
- Go to Security β App passwords
- Select Mail as the app
- Copy the generated 16-character password
Add these to your .env.local file:
# SMTP Configuration
SMTP_PROVIDER=gmail
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_16_character_app_password
SMTP_FROM_EMAIL=your_email@gmail.comnpm run devSMTP_PROVIDER=gmail
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
SMTP_FROM_EMAIL=your_email@gmail.comSMTP_PROVIDER=outlook
SMTP_USER=your_email@outlook.com
SMTP_PASS=your_password
SMTP_FROM_EMAIL=your_email@outlook.comSMTP_PROVIDER=yahoo
SMTP_USER=your_email@yahoo.com
SMTP_PASS=your_app_password
SMTP_FROM_EMAIL=your_email@yahoo.comSMTP_PROVIDER=custom
SMTP_HOST=smtp.yourdomain.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your_email@yourdomain.com
SMTP_PASS=your_password
SMTP_FROM_EMAIL=your_email@yourdomain.com- Open Malify at http://localhost:3000
- Click the Mail icon (π§) in the header
- Click Test Connection to verify SMTP settings
- Enter a test email address and click Send to send a test email
You can also test SMTP via API:
# Test connection
curl -X GET http://localhost:3000/api/smtp/test
# Send test email
curl -X POST http://localhost:3000/api/smtp/test \
-H "Content-Type: application/json" \
-d '{"testEmail": "test@example.com"}'- Compose Email: User writes email in the compose modal
- SMTP Attempt: System tries to send via configured SMTP
- Success: Email is sent and marked as "Sent" in database
- Failure: Email is saved as "Draft" with error message
- Database Record: All emails are stored regardless of SMTP status
- If SMTP fails, the email is automatically saved as a draft
- Users receive clear error messages about SMTP issues
- Failed emails can be resent after fixing SMTP configuration
- β Use App Passwords for Gmail, Yahoo (not your regular password)
- β Enable 2FA before generating app passwords
- β Rotate passwords regularly
- β
Never commit
.env.localto version control - β Use strong passwords for SMTP authentication
- β Restrict SMTP access to your application only
- β Check your internet connection
- β Verify SMTP credentials are correct
- β Ensure 2FA and app passwords are set up (Gmail/Yahoo)
- β Check if your email provider requires app passwords
- β Use app password instead of regular password
- β Verify username/email is correct
- β Check if account has SMTP access enabled
- β Check SMTP host and port settings
- β Verify firewall isn't blocking SMTP ports
- β Try different SMTP ports (587, 465, 25)
- β Check recipient's spam/junk folder
- β Verify sender reputation (new domains may be flagged)
- β Check if recipient's server accepts your domain
- Test Connection: Use the built-in SMTP test feature
- Check Logs: Look at server console for detailed error messages
- Verify Settings: Double-check all environment variables
- Test with Different Provider: Try Gmail if using custom SMTP
| Provider | Ease of Setup | Daily Limit | Notes |
|---|---|---|---|
| Gmail | βββββ | 500 emails | Recommended for development |
| Outlook | ββββ | 300 emails | Good alternative to Gmail |
| Yahoo | βββ | 500 emails | Requires app password |
| Custom | ββ | Varies | Best for production |
- Use Professional SMTP: Consider services like SendGrid, Mailgun, or AWS SES
- Domain Authentication: Set up SPF, DKIM, and DMARC records
- Rate Limiting: Implement sending limits to avoid being flagged
- Monitoring: Track delivery rates and bounce rates
- Compliance: Ensure GDPR/CAN-SPAM compliance
SMTP_PROVIDER=custom
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=apikey
SMTP_PASS=your_sendgrid_api_key
SMTP_FROM_EMAIL=noreply@yourdomain.comPOST /api/emails
{
"to": "recipient@example.com",
"cc": "cc@example.com", // optional
"bcc": "bcc@example.com", // optional
"subject": "Hello World",
"body": "This is a test email",
"isDraft": false
}GET /api/smtp/test
// Returns: { connection: { success: boolean, error?: string } }POST /api/smtp/test
{
"testEmail": "test@example.com"
}
// Returns: { result: { success: boolean, messageId?: string, error?: string } }Your Gmail clone now has full SMTP capabilities! You can:
- Send real emails to anyone
- Test your SMTP configuration
- Handle errors gracefully
- Track sent emails
Need help? Check the troubleshooting section or open the SMTP settings panel in your app for guided setup.