Quick Answer

To configure an SMTP host: pick an SMTP server (your ESP or mail provider), enter the server hostname, port (587 for STARTTLS or 465 for SSL), enable encryption, provide authentication credentials (username and password or API key), and set the From: address. Most apps use port 587 with STARTTLS authentication. Verify the configuration by sending a test message. SMTP server configuration is identical across most platforms — the differences are in credentials and limits.

How to Configure an SMTP Host (Any Platform)

By Braedon·Mailflow Authority·Email Infrastructure·Updated 2026-05-16

What Configuring an SMTP Host Means

"Configuring an SMTP host" means telling your app or device where to send outgoing email. Every email-sending app needs:

  1. Server hostname — the SMTP server's address (e.g., smtp.sendgrid.net)
  2. Port — typically 587 (STARTTLS) or 465 (SSL/TLS)
  3. Encryption — STARTTLS, SSL/TLS, or rarely none
  4. Authentication — credentials (username/password or API key)
  5. From: address — the sender shown to recipients

These six pieces of info comprise standard SMTP configuration across virtually every app and platform.

Setup SMTP: The Standard Process

1. Choose an SMTP provider

For most apps:

  • Transactional email: Postmark, Resend, SendGrid, Mailgun
  • From a mailbox: Gmail SMTP, Outlook SMTP, Office 365 SMTP
  • Self-hosted: Postfix, Mailcow (advanced)

2. Get credentials

Sign up with your chosen provider. They give you:

  • SMTP hostname
  • Port and encryption
  • Username (often apikey or your email)
  • Password (often an API key)

3. Enter in your app

Look for "SMTP settings," "Email settings," or "Outgoing mail server" in your app's admin. Enter the values your provider gave you.

4. Verify

Send a test message. If it lands successfully, you're done. If it fails, check the error message — usually authentication or encryption settings.

Common SMTP Configuration Values

Reference for popular providers:

ProviderHostPortEncryption
Gmailsmtp.gmail.com587STARTTLS
Gmail Workspace Relaysmtp-relay.gmail.com587STARTTLS
Outlook.comsmtp-mail.outlook.com587STARTTLS
Office 365smtp.office365.com587STARTTLS
SendGridsmtp.sendgrid.net587STARTTLS
Mailgunsmtp.mailgun.org587STARTTLS
Postmarksmtp.postmarkapp.com587STARTTLS
Resendsmtp.resend.com587STARTTLS
AWS SESemail-smtp.region.amazonaws.com587STARTTLS
Mailjetin-v3.mailjet.com587STARTTLS

Port 587 with STARTTLS is the modern standard. Port 465 with SSL/TLS works at most providers. Port 25 is for server-to-server only and blocked by most cloud providers and ISPs.

SMTP Conf File Format (For Servers)

For self-hosted setups, SMTP conf typically refers to a Postfix main.cf, Exim exim.conf, or similar. Key directives:

# Postfix main.cf example
myhostname = mail.yourdomain.com
mydomain = yourdomain.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.yourdomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.yourdomain.com/privkey.pem
smtpd_use_tls = yes
smtpd_sasl_auth_enable = yes

See Postfix configuration for email marketing for full walkthrough.

Verifying SMTP Configuration

Test from command line (Linux/Mac):

swaks --to [email protected] --from [email protected] \
  --server smtp.provider.com:587 \
  --tls --auth-user "username" --auth-password "password"

Test via web tool:

  • Send to [email protected] and check the resulting report
  • Use MXToolbox SMTP Diagnostics tool

Common test failures:

  • Wrong port (use 587)
  • Wrong encryption (use STARTTLS for port 587)
  • Bad credentials (verify with provider dashboard)
  • Sender verification missing (some providers require domain verification before sending)

SMTP Host Configuration Mistakes

Using port 25 from an app

Port 25 is for server-to-server SMTP. Apps should use 587 (STARTTLS) or 465 (SSL). Port 25 is blocked by most ISPs and cloud providers anyway.

Disabling TLS

Many older docs suggest "no encryption" as a fallback. Never use unencrypted SMTP for any modern app — providers will reject it.

Hardcoding password in source code

SMTP passwords (especially API keys) should be in environment variables or secret managers, not committed to source.

Sending from unverified domains

Modern SMTP providers require domain verification (SPF, DKIM) before allowing sending from your domain. Set up authentication BEFORE you try to send.

Wrong username format

Some providers (Gmail, Outlook) require full email address as username. Others (SendGrid) require literal string apikey. Read provider docs.

Practitioner note: The "how to setup SMTP server" question has two very different answers depending on intent. If you mean "configure my app to use SMTP," it's a 10-minute job. If you mean "install and run an SMTP server I control," it's a 1-2 week project with significant ongoing maintenance. Most senders mean the first; most should not pursue the second.

Practitioner note: Free SMTP servers exist (Gmail at 500/day, some cheap providers at low volume) but they all have hard limits. For any production app, budget for a real SMTP provider — typically $15-50/month for moderate volume. The cost of "free" is unreliable delivery, no support, and growth ceilings.

Practitioner note: When configuring SMTP for client work (agency context), document the credentials and config in your runbook immediately. SMTP credentials get lost; provider dashboards change. A 5-minute documentation discipline saves hours of "how was this configured?" investigation later.

If you're configuring SMTP for a new app, switching providers, or troubleshooting authentication issues, book a consultation. I configure SMTP across self-hosted, hosted, and hybrid sending infrastructures regularly.

Sources


v1.0 · May 2026

Frequently Asked Questions

How to setup SMTP server?

Two options: use an existing SMTP server (SendGrid, Mailgun, Gmail, Office 365) by entering its credentials in your app, OR install your own SMTP server (Postfix, hMailServer, Mailcow). For 99% of use cases, use an existing provider — easier, more reliable, better deliverability. Configure your app with: server hostname, port 587, STARTTLS, username, password.

How to configure SMTP host?

In your app or device: SMTP server (host) = your provider's hostname (e.g., smtp.sendgrid.net, smtp.gmail.com, smtp.office365.com). Port = 587 for STARTTLS (recommended). Encryption = STARTTLS or TLS. Authentication = required, with username and password from your provider. Test with a real send to verify.

How to install an SMTP server?

For Linux: install Postfix (apt install postfix or dnf install postfix) and configure /etc/postfix/main.cf. For Windows: install hMailServer or MailEnable. For full stack with web interface: deploy Mailcow via Docker. None of these are recommended for sending bulk or transactional mail at scale — use a hosted SMTP provider instead.

How to make an SMTP server?

Building your own SMTP server involves installing mail transfer agent software (Postfix, Exim, Stalwart), configuring DNS (MX, PTR, SPF, DKIM, DMARC), opening port 25/587, and warming up the IP. The full process takes 1-2 weeks if you know what you're doing. For most needs, using a hosted SMTP provider is faster, cheaper, and more reliable.

How to create an SMTP server from scratch?

Steps: 1) Provision a VPS (DigitalOcean, Hetzner, Vultr) with port 25 unblocked. 2) Set up reverse DNS (PTR record) matching your hostname. 3) Install Postfix, Mailcow, or similar. 4) Configure SPF, DKIM, DMARC. 5) Warm up the IP over 4-8 weeks. 6) Monitor reputation. See our [Mailcow setup guide](/self-hosted-smtp/mailcow-setup-guide) for a complete walkthrough.

Want this handled for you?

Free 30-minute strategy call. Walk away with a plan either way.