使用Postfix通过多个Google Apps帐户进行中继

我正在设置一个networking应用程序,需要通过使用Google Apps的域上的两个不同的电子邮件地址发送电子邮件。 我使用Postfix作为中继,因为我相当熟悉它。

不过,我正在努力解决如何使用同一个域上的两个不同的电子邮件地址进行工作。 我得到的印象是,你需要在/ etc / postfix / sasl中设置两个不同的密码文件,我已经完成了,然后设置smtp_sasl_password_maps哈希:/ etc / postfix / sasl / passwd, m不太确定两个不同文件所需的语法。 我试过把它设置如下:

smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd, hash:/etc/postfix/sasl/passwd2 

但是这似乎并没有办法。 我也尝试了在一个文件中,但也没有工作。 无论我尝试什么方法,它似乎都只能在一个地址上find。 Google似乎对这个问题也没有太大帮助?

任何人都可以看到我在这里误入歧途吗?

编辑:也许我不太清楚我想做什么。

example.com的web服务器安装了Postfix,但是MXlogging指向了Google Apps。 有两个电子邮件地址,[email protected][email protected],并且都在Google Apps上。 我想要做的就是将Postfixconfiguration为使用Google Apps作为这两个电子邮件地址的中继。

问题是,我不知道如何设置这两个帐户的密码映射,因此我只能将其设置为一个,而不是两个。

您需要启用发件人相关的身份validation,以便Postfix将根据正在传递的邮件的发件人select适当的凭据。 密码图应由发件人地址代替中继主机。

main.cf

 smtp_sender_dependent_authentication = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_password_maps 

sasl_password_maps

 [email protected] [email protected]:password123 [email protected] [email protected]:password456 

依赖发件人的authentication可以提供帮助 官方文件中有很好的例子 。

Postfix支持不同的ISP帐号,用于不同的发件人地址(版本2.3和更高版本)。 当一个人使用相同的机器进行工作和个人使用,或者具有不同ISP帐户的人共享相同的Postfix服务器时,这可能很有用。

为了做到这一点,Postfix支持每个发件人的SASL密码和每个发件人的中继主机。 在下面的示例中,Postfix SMTP客户端将按照发件人地址searchSASL密码文件,然后按目的地search相同的文件。 同样,Postfix trivial-rewrite(8)守护程序将search每个发件人的relayhost文件,并使用默认的relayhost设置作为最后的手段。

/etc/postfix/main.cf文件:

 smtp_sender_dependent_authentication = yes sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd relayhost = [mail.isp.example] # Alternative form: # relayhost = [mail.isp.example]:port 

/等/后缀/ sasl_passwd:

 # Per-sender authentication; see also /etc/postfix/sender_relay. [email protected] username1:password1 [email protected] username2:password2 # Login information for the default relayhost. [mail.isp.example] username:password # Alternative form: # [mail.isp.example]:port username:password 

/等/后缀/ sender_relay:

 # Per-sender provider; see also /etc/postfix/sasl_passwd. [email protected] [mail.example.com]:port [email protected] [mail.example.net] 
  • 每当更改sasl_passwd表时,都执行命令“postmap / etc / postfix / sasl_passwd”。
  • 每当更改sender_relay表时,都执行命令“postmap / etc / postfix / sender_relay”。