Docs Providers

Custom SMTP

Configure any SMTP server as your email provider.

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

  1. SMTP server hostname and port
  2. Authentication credentials (username and password)
  3. TLS/SSL configuration details

Common SMTP Configurations

Gmail SMTP

FieldValue
Hostsmtp.gmail.com
Port587
SecureNo (STARTTLS)
UsernameYour Gmail address
PasswordApp password (not your regular password)

Note: Gmail requires an App Password. Go to Google Account > Security > App Passwords.

Outlook/Microsoft 365

FieldValue
Hostsmtp.office365.com
Port587
SecureNo (STARTTLS)
UsernameYour email address
PasswordYour password or app password

Mailgun SMTP

FieldValue
Hostsmtp.mailgun.org
Port587
SecureNo (STARTTLS)
Usernamepostmaster@your-domain.com
PasswordSMTP password from Mailgun

Configuration

Add Custom SMTP in mailshit:

  1. Go to Settings > Providers
  2. Click Add Provider
  3. Select SMTP (Nodemailer)
  4. Enter the following:
FieldDescriptionExample
SMTP HostServer hostnamesmtp.example.com
SMTP PortServer port587
UsernameAuth usernameuser@example.com
PasswordAuth passwordyour-password
From EmailSender emailhello@yourdomain.com
From NameDisplay name (optional)Your Company
  1. Click Save

Port and Security Options

PortSecurityDescription
25NoneUnencrypted (not recommended)
465SSL/TLSImplicit TLS (legacy)
587STARTTLSRecommended for most servers
2525STARTTLSAlternative 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:

  1. Add the SMTP provider in mailshit
  2. Create a simple test template
  3. Set up a flow with the SMTP output
  4. Send a test email to yourself
  5. 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:

FieldValue
Hostlocalhost
Port1025
Username(leave empty)
Password(leave empty)

Best Practices

  1. Use TLS whenever possible
  2. Use App Passwords for Gmail/Outlook instead of real passwords
  3. Don’t use port 25 - often blocked and insecure
  4. Test thoroughly before production use
  5. 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