如何使用Google Apps从“[email protected]”设置Postfix发送邮件?

我有一个Postfix邮件服务器设置。 我input了一个帐户凭据。邮件服务器通过Google Apps邮件服务器发送邮件。 所以在后缀configuration文件中我有我的gmail凭据:

[email protected] mypassword 

在我的PHP应用程序中,我使用mail()函数发送邮件。

一切正常,除了我设置'从'标题地址,它总是说它来自[email protected]

我已经使用其他的设置,电子邮件的'从'标题可以改变,所以我可以有[email protected][email protected]等。

任何帮助将不胜感激如何设置。

你不能在Postfix级别改变它。 Postfix已经做了你想要的。 Google会用授权帐户replace发件人。 这是Google Apps不允许伪造发件人的“function”。

编辑:如果您不更改Google Apps,那么您必须更改Postfix的行为。

main.cf编辑或者添加:

 sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relayhost smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/smtp_relayhost_auth smtp_sasl_security_options = noanonymous smtp_sender_dependent_authentication = yes 

/etc/postfix/sender_relayhost放入:

 [email protected] [aspmx.l.google.com] [email protected] [aspmx.l.google.com] 

/etc/postfix/smtp_relayhost_auth

 [email protected] [email protected]:mypassword [email protected] [email protected]:hispassword 

等等。