About Custom SMTP
Connect any SMTP server to mailshit. This is useful for:
- Using your existing mail server
- Providers without direct integration
- Self-hosted email infrastructure
- Testing with local SMTP servers
Prerequisites
- SMTP server hostname and port
- Authentication credentials (username and password)
- TLS/SSL configuration details
Common SMTP Configurations
Gmail SMTP
| Field | Value |
|---|---|
| Host | smtp.gmail.com |
| Port | 587 |
| Secure | No (STARTTLS) |
| Username | Your Gmail address |
| Password | App password (not your regular password) |
Note: Gmail requires an App Password. Go to Google Account > Security > App Passwords.
Outlook/Microsoft 365
| Field | Value |
|---|---|
| Host | smtp.office365.com |
| Port | 587 |
| Secure | No (STARTTLS) |
| Username | Your email address |
| Password | Your password or app password |
Mailgun SMTP
| Field | Value |
|---|---|
| Host | smtp.mailgun.org |
| Port | 587 |
| Secure | No (STARTTLS) |
| Username | postmaster@your-domain.com |
| Password | SMTP password from Mailgun |
Configuration
Add Custom SMTP in mailshit:
- Go to Settings > Providers
- Click Add Provider
- Select SMTP (Nodemailer)
- Enter the following:
| Field | Description | Example |
|---|---|---|
| SMTP Host | Server hostname | smtp.example.com |
| SMTP Port | Server port | 587 |
| Username | Auth username | user@example.com |
| Password | Auth password | your-password |
| From Email | Sender email | hello@yourdomain.com |
| From Name | Display name (optional) | Your Company |
- Click Save
Port and Security Options
| Port | Security | Description |
|---|---|---|
| 25 | None | Unencrypted (not recommended) |
| 465 | SSL/TLS | Implicit TLS (legacy) |
| 587 | STARTTLS | Recommended for most servers |
| 2525 | STARTTLS | Alternative port (some hosts block 587) |
Security Setting
- Secure: Yes - Use implicit TLS (port 465)
- Secure: No - Use STARTTLS upgrade (port 587)
Most modern servers use port 587 with STARTTLS.
Testing Your Configuration
Before production use:
- Add the SMTP provider in mailshit
- Create a simple test template
- Set up a flow with the SMTP output
- Send a test email to yourself
- Check for delivery and proper formatting
Example Response
{
"success": true,
"type": "sent",
"messageId": "<abc123@smtp.example.com>"
}
Local Development
For local testing, use services like:
- Mailhog -
localhost:1025(no auth) - Mailcatcher -
localhost:1025(no auth) - Mailtrap - SMTP sandbox service
Example Mailhog configuration:
| Field | Value |
|---|---|
| Host | localhost |
| Port | 1025 |
| Username | (leave empty) |
| Password | (leave empty) |
Best Practices
- Use TLS whenever possible
- Use App Passwords for Gmail/Outlook instead of real passwords
- Don’t use port 25 - often blocked and insecure
- Test thoroughly before production use
- Monitor delivery - SMTP errors can be cryptic
Troubleshooting
“Connection refused”
- Check hostname and port are correct
- Verify firewall allows outbound connections
- Try alternative ports (587, 465, 2525)
“Authentication failed”
- Verify username and password
- For Gmail, use an App Password
- Check if 2FA requires special handling
“Certificate error”
- Server may use self-signed certificate
- Check the Secure setting matches server configuration
Emails not delivering
- Check spam folder
- Verify sender domain has proper DNS (SPF, DKIM, DMARC)
- Check SMTP server logs for rejection reasons