如何配置Confluence调用Postfix邮件服务器发送邮件?
Hey there! Let's break down exactly what you need to do to get Confluence sending emails through your local Postfix server (which is already set up to relay via AWS SES). We'll cover both Postfix checks and Confluence configuration steps:
First: Verify Postfix is Ready to Accept Requests from Confluence
Since Confluence and Postfix are on the same AWS instance, Postfix should already allow local connections by default—but it's good to double-check to avoid headaches later:
Check Postfix network settings
Run these commands in your instance's terminal to confirm the config:postconf | grep inet_interfaces postconf | grep mynetworksinet_interfacesshould be set tolocalhostorall(so Postfix listens for local connections)mynetworksshould include127.0.0.0/8(this allows localhost to send emails without authentication)
Update config if needed
If either setting is incorrect, edit the Postfix main config file:sudo nano /etc/postfix/main.cfAdjust the lines to match:
inet_interfaces = localhost mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128Save the file, then restart Postfix to apply changes:
sudo systemctl restart postfixTest Postfix first
Before touching Confluence, confirm Postfix can send emails via SES on its own:echo "This is a test email from Postfix" | mail -s "Postfix Test" your-test-email@example.comIf this arrives, your Postfix <-> SES setup is working correctly.
Second: Configure Confluence to Use Local Postfix
You will need to update Confluence's mail server settings—here's how to do it step by step:
- Log into your Confluence instance as an administrator.
- Navigate to General Configuration > Mail Servers (this is under the "Administration" menu in the top-right).
- Either edit your existing mail server configuration, or click "Add New Mail Server".
- Fill in the settings as follows:
- Mail Server Type: Select
SMTP - Mail Server: Enter
localhost(since Postfix is running on the same machine) - Port: Use
25(Postfix's default unencrypted SMTP port—no need for SSL/TLS here because it's a local connection) - Username/Password: Leave these blank (Postfix allows localhost connections without authentication, thanks to the
mynetworkssetting we checked earlier) - Connection Security: Select
None - From Address: Keep the same verified email address you used with AWS SES (Postfix will relay this to SES, so it needs to be a valid, SES-verified address)
- Mail Server Type: Select
- Click Send Test Email to verify the setup works. If the test email arrives, you're good to go!
- Save the configuration, and Confluence will now send all outgoing emails through your local Postfix server.
Quick Troubleshooting Tips
- If Confluence can't connect to Postfix: Double-check that Postfix is running (
sudo systemctl status postfix) and that theinet_interfaces/mynetworkssettings are correct. - If emails are stuck in Postfix: Check the mail queue with
postqueue -pand logs withtail -f /var/log/mail.logto debug any SES relay issues.
内容的提问来源于stack exchange,提问作者Nataraj

