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

如何让局域网内其他机器使用本机的Postfix邮件服务(CCDC)

Setting Up Postfix for LAN Email in CCDC

Hey there! As someone prepping for CCDC with a Postfix server on Ubuntu, let's get this sorted so all your team's LAN machines can send and receive emails through your host. Since you already have Postfix installed, we just need to tweak a few key configurations:

1. Update Postfix Listening Interfaces

By default, Postfix might only listen on localhost, which blocks LAN connections. Let's change that:

  • Open the main config file with: sudo nano /etc/postfix/main.cf
  • Find the inet_interfaces line and update it to either:
    • inet_interfaces = all (listens on all available network interfaces)
    • Or specify your Ubuntu host's LAN IP explicitly: inet_interfaces = 127.0.0.1, 192.168.x.x (replace 192.168.x.x with your actual static LAN IP)
  • Make sure inet_protocols is set to ipv4 (or all if you use IPv6) to avoid connectivity issues.

2. Allow LAN Clients to Connect

Postfix uses the mynetworks setting to define trusted IP ranges that can send emails without authentication (perfect for your closed CCDC LAN):

  • In the same main.cf file, locate mynetworks and update it to include your LAN subnet. For example:
    mynetworks = 127.0.0.0/8, 192.168.1.0/24
    
    Replace 192.168.1.0/24 with your team's actual LAN subnet (e.g., 10.0.0.0/24 if that's your CCDC network range).

3. Configure Local Email Destinations

Ensure Postfix recognizes emails addressed to your LAN domain or server hostname:

  • Find the mydestination line in main.cf and add your server's local hostname or domain. For example:
    mydestination = $myhostname, localhost.$mydomain, localhost, mail-server.local
    
    Replace mail-server.local with your server's actual hostname (check with hostname command).

4. Restart Postfix & Verify

Save your changes to main.cf (Ctrl+O, then Ctrl+X in nano) and restart the service to apply updates:

  • sudo systemctl restart postfix
  • Check if Postfix is running correctly: sudo systemctl status postfix
    You should see "active (running)" in the output.

5. Open Firewall for SMTP

Ubuntu's default UFW firewall might block port 25 (SMTP), so let's allow it for LAN traffic:

  • sudo ufw allow 25/tcp

6. Test LAN Email Functionality

Grab another machine on the LAN to test sending an email:

  • On a Linux client:
    echo "This is a test email from the LAN" | mail -s "CCDC Postfix Test" your-username@mail-server.local -S smtp=smtp://192.168.x.x
    
  • On a Windows client (PowerShell):
    Send-MailMessage -From "team-member@client.local" -To "your-username@mail-server.local" -SmtpServer "192.168.x.x" -Subject "CCDC Postfix Test" -Body "This is a test from Windows!"
    
    Replace 192.168.x.x with your Postfix server's LAN IP, and adjust email addresses to match your setup.

Quick CCDC Tips

  • Set a static LAN IP for your Postfix server so team members don't lose connectivity if the IP changes.
  • If you need to retrieve emails (not just send), install Dovecot for POP3/IMAP access—this lets clients like Thunderbird fetch emails from the server.
  • Keep an eye on Postfix logs (/var/log/mail.log) if you run into issues—they'll help troubleshoot connection or delivery problems fast.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.19 03:24:45