You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Windows 10及EC2 Windows实例配置为SMTP服务器与邮件服务器?

Hey there! Let's walk through how to set up both an SMTP server and a full-featured mail server on Windows 10—including AWS EC2 instances. I’ll keep this hands-on and step-by-step so you can get up and running without headaches.

1. Configuring Windows 10 as an SMTP Server

Windows 10 includes an SMTP server component via IIS, so we’ll start there.

1.1 Install IIS & SMTP Server Feature

  • Open Control Panel → Programs → Turn Windows features on or off
  • Expand Internet Information Services → Check IIS Management Console (under Web Management Tools)
  • Expand Internet Information Services → World Wide Web Services (keep default core features enabled)
  • Expand Internet Information Services → Check SMTP Server
  • Click OK and wait for the installation to complete.

1.2 Configure the SMTP Server

You’ll need to use IIS 6.0 Manager to configure SMTP (since it’s not integrated with the newer IIS consoles):

  • Search for IIS 6.0 Manager in the Start Menu and open it.
  • Expand your server name, then right-click SMTP Virtual Server #1 → Properties
  • General Tab

    • Set the IP address to All Unassigned (or a specific IP if you have multiple network interfaces)
    • Adjust connection limits here if you need to restrict concurrent connections.
  • Access Tab

    • Click Authentication: Choose Anonymous access (not recommended for public use) or Basic authentication (requires a username/password for sending)
    • Click Connection: Restrict allowed IPs to trusted sources only (critical for security)
    • Click Relay: Specify which IPs can relay emails through this server. For AWS EC2, this might be your VPC IP range or specific instances.
  • Delivery Tab

    • Click Outbound Security: If you need to route emails through an external SMTP service (like Gmail), set up authentication (username/password) and enable TLS here.
    • Click Outbound Connections: Use port 587 or 465 for TLS (many ISPs block port 25 by default)
    • Click Advanced: Set your server’s fully qualified domain name (FQDN). For AWS EC2, use your instance’s public DNS or a custom domain you’ve pointed to it.

1.3 AWS EC2 Windows Instance SMTP Setup Extra Steps

EC2 has some unique hoops to jump through:

  • Security Groups: Open inbound ports 25, 587, and 465 from trusted IPs. Note that AWS blocks port 25 by default for new accounts—you’ll need to submit a support request to lift this restriction if you plan to use it.
  • Elastic IP: Assign an Elastic IP to your instance so its public IP doesn’t change on reboot.
  • Reverse DNS (PTR Record): For better email deliverability, set up a PTR record in AWS Route 53 pointing your Elastic IP to your FQDN. Most email providers reject messages without a valid PTR.
2. Configuring Windows 10 as a Full Mail Server (SMTP + POP3/IMAP)

SMTP only handles sending emails—for receiving and accessing emails via clients, you’ll need POP3/IMAP. Windows 10 doesn’t include these natively, so we’ll use hMailServer (a free, open-source tool that works great on Windows).

2.1 Install hMailServer

  • Grab the latest hMailServer installer and run it.
  • Choose the Full installation option to get all components.
  • Set a strong admin password (you’ll need this later to manage the server).
  • Select Local database (MySQL) for simplicity, or use an external database if you have one set up.

2.2 Configure hMailServer

Open the hMailServer Administrator and log in with your admin password, then follow these steps:

  • Add Your Domain

    • Go to Domains → Add
    • Enter your domain name (e.g., yourdomain.com). For EC2, use your custom domain or public DNS.
  • Set Up SMTP

    • Navigate to Settings → Protocols → SMTP
    • General: Set the listening IP to your server’s IP (or "All unassigned")
    • Delivery: Input your FQDN, and configure outbound delivery (use an external SMTP service if needed)
    • Relay: Restrict relay to trusted IPs to prevent your server from being used for spam.
  • Enable POP3/IMAP

    • Go to Settings → Protocols → POP3: Enable it, set port 110 (use 995 for TLS)
    • Go to Settings → Protocols → IMAP: Enable it, set port 143 (use 993 for TLS)
  • Create Mail Accounts

    • Go to Domains → Your Domain → Accounts → Add
    • Set an email address (e.g., john@yourdomain.com), password, and storage limits.

2.3 AWS EC2 Full Mail Server Extra Steps

  • Security Groups: Open inbound ports for POP3 (110, 995), IMAP (143, 993), and SMTP (25, 587, 465) from trusted IPs.
  • DNS Records:
    • A Record: Point mail.yourdomain.com to your Elastic IP.
    • MX Record: Set your domain’s MX record to mail.yourdomain.com with priority 10.
    • SPF Record: Add an SPF record like v=spf1 ip4:YOUR_ELASTIC_IP -all to your domain’s DNS to improve deliverability.
    • DKIM Record: Set up DKIM in hMailServer (under Settings → Advanced → DKIM) and add the corresponding DNS record to your domain—this helps prevent your emails from being marked as spam.
  • Windows Firewall: Make sure the hMailServer ports are allowed through the Windows Firewall on your EC2 instance.
3. Critical Tips to Avoid Headaches
  • Security First: Never leave your SMTP server open to the world (open relay)—this will get your IP blacklisted instantly. Always restrict relay and use authentication.
  • Deliverability: Major email providers (Gmail, Outlook) are strict about incoming messages. Ensure you have valid PTR, SPF, and DKIM records set up to avoid being marked as spam.
  • AWS Port 25: If you need to use port 25, submit a request to AWS Support to lift the default block. For most cases, using 587 or 465 with TLS is safer and avoids this step.
  • Test Everything: Use telnet your-server-ip 25 to test SMTP connectivity, and send a test email from a client like Outlook or Thunderbird to verify POP3/IMAP works.

内容的提问来源于stack exchange,提问作者Gurpreet Singh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 13:52:33