DEV Community

Cover image for Pexl Keys - How to install smtp server on windows server 2022 ?
Pexl Keys
Pexl Keys

Posted on

Pexl Keys - How to install smtp server on windows server 2022 ?

How to Install and Configure an SMTP Server on Windows Server 2022

Windows Server 2022 does not include a built-in SMTP server, but you can set up an SMTP relay using IIS (Internet Information Services) Manager and the Simple Mail Transfer Protocol (SMTP) feature.

Step 1: Install the SMTP Server Feature

  1. Open Server Manager
  • Click Start → Server Manager.

2. Add Roles and Features

  • Click Manage → Add Roles and Features.
  • Click Next until you reach Server Roles.
  • Expand Web Server (IIS) → Add SMTP Server.
  • Click Next, then Install.
  • Wait for the installation to complete, then close the wizard.

Step 2: Configure the SMTP Server

1. Open IIS 6.0 Manager (for SMTP configuration)

  • Press Win + R, type inetmgr6, and press Enter.
  • In the left panel, expand the server node.
  • Right-click [SMTP Virtual Server] → Click Properties.

2. Set the IP Address

  • Under the General tab, choose the server’s IP address.

3. Allow Relaying (If Required)

  • Go to the Access tab → Click Relay.
  • Add specific IP addresses that are allowed to send emails.

4. Set Authentication (Optional)

  • Go to the Delivery tab → Click Outbound Security.
  • If using an external SMTP service (e.g., Titan Mail, Office 365), enter the authentication details.

Step 3: Open the SMTP Port in Windows Firewall

  1. Open Windows Defender Firewall → Click Advanced Settings.
  2. Select Inbound Rules → Click New Rule.
  3. Choose Port → Select TCP → Enter 25, 587, 465 (as needed).
  4. Allow the connection → Name it SMTP Service → Click Finish.

Step 4: Test the SMTP Server

Open Command Prompt (cmd) and type:

telnet localhost 25

If the SMTP server responds, it is working.
You can also use PowerShell to send a test email:

Send-MailMessage -From "you@example.com" -To "recipient@example.com" -Subject "Test Email" -Body "SMTP is working!" -SmtpServer "your_server_ip"

Alternative: Use a Third-Party SMTP Server
If you need better security and deliverability, consider using Titan Mail, Office 365 SMTP, or Gmail SMTP instead of a local SMTP server.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay