Postfix配置多用户中继服务器
本文最后更新于 217 天前,其中的信息可能已经有所发展或是发生改变。

Postfix设置邮件中继:设置使用同一个relay smtp.a.com,user1@c.com使用a@a.com 密码为123456邮件账户,user2@c.com使用b@a.com密码为123456邮件账户

To set up Postfix to use the same relay server smtp.a.com for both user1@c.com and user2@c.com with different credentials, you can follow these steps:

  1. Edit the Postfix main configuration file. This file is usually located at /etc/postfix/main.cf. Open it in a text editor.
  2. Find or add the following configuration options to configure the relay server and authentication:
relayhost = smtp.a.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
  1. Create the /etc/postfix/sasl_passwd file if it doesn’t exist, and add the following lines:
smtp.a.com user1@c.com:a@a.com:123456
smtp.a.com user2@c.com:b@a.com:123456

Replace a@a.com with the username for user1@c.com, b@a.com with the username for user2@c.com, and 123456 with the corresponding passwords.

  1. Run the following command to generate the hash database for the sasl_passwd file:
sudo postmap /etc/postfix/sasl_passwd
  1. Reload or restart the Postfix service to apply the changes:
sudo systemctl reload postfix

With these configurations, Postfix should now relay emails for user1@c.com using the credentials a@a.com and the password 123456, and for user2@c.com using the credentials b@a.com and the password 123456.

上一篇
下一篇