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.

Dev Diairies image

User Feedback & The Pivot That Saved The Project

🔥 Check out Episode 3 of Dev Diairies, following a successful Hackathon project turned startup.

Watch full video 🎥

Top comments (0)

Build seamlessly, securely, and flexibly with MongoDB Atlas. Try free.

Build seamlessly, securely, and flexibly with MongoDB Atlas. Try free.

MongoDB Atlas lets you build and run modern apps in 125+ regions across AWS, Azure, and Google Cloud. Multi-cloud clusters distribute data seamlessly and auto-failover between providers for high availability and flexibility. Start free!

Learn More

👋 Kindness is contagious

Delve into this thought-provoking piece, celebrated by the DEV Community. Coders from every walk are invited to share their insights and strengthen our collective intelligence.

A heartfelt “thank you” can transform someone’s day—leave yours in the comments!

On DEV, knowledge sharing paves our journey and forges strong connections. Found this helpful? A simple thanks to the author means so much.

Get Started