want email from my server (postfix) to an email address on my domain to be delivered to google apps

want email from my server (postfix) to an email address on my domain to be delivered to google apps

坚持沉默 发布于 2021-11-27 字数 700 浏览 1007 回复 3 原文

I have google apps for receiving email. I get inquiries from people on info@[my-domain.com], which email is hosted on google.

Sometimes, I want my rails set-up to send emails from my own server, and that works fine. But when I want to send to an email address on my own domain, such as info@my-domain.com, postfix sees the my-domain.com and tries to deliver locally.

I understand that's normal, but I'd like to have those emails go to google apps rather than try to be delivered locally.

I know there's a postfix config file for aliases, but here, the email addresses are the same, just need to tell postfix not to try to deliver locally.

Any way to do this?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


凉月流沐 2022-06-07 3 楼

Either, as Barry Brown suggested, tell postfix that my-domain.com is not local by removing it from $mydestination on the postfix box, or if that's not practical, use virtual aliases in Postfix to rewrite that specific address (info@my-domain.com) to the google-hosted address you want to deliver it to.

Virtual aliases in Postfix are not just for the virtual alias address class; they are a general-purpose pre-queue address rewriting mechanism. Sendmail-style aliases (depending on your distribution, either /etc/aliases or /etc/postfix/aliases) are used by the local delivery agent and only apply to the local address class. You could, of course, use sendmail-style aliases to forward mail for "info" to some-address@your-google-hosted-domain.

The documentation at postfix.org is pretty good. Try





牛↙奶布丁 2022-06-07 2 楼

I get around it by doing this http://souptonuts.sourceforge.net/postfix_tutorial.html. Basically have that mail sent through one of your google domain accounts instead of locally.

强辩 2022-06-07 1 楼

It sounds like you have two mail servers set up to act as the primary destination for email to your domain: Google Apps and your postfix server. You can't do that because, as you've found, mail sometimes gets delivered to one server and sometimes the other.

Presumably you want Google Apps to be the primary destination. That is, mail for your domain should go to the Google servers, not yours. You will need to re-configure postfix so that it is not the mail server for your domain.

Edit the /etc/postfix/main.cf file and look for the mydestination line. Remove your domain from that line.

I don't normally use postfix, but I think if the line looks like this, you'll be good:

mydestination = $myhostname localhost.$mydomain localhost

Let's say your server name is "test1" and your domain is "example.com." The following addresses would be delivered locally:


But mail to info@example.com would go to Google Apps because postfix is not configured to accept mail for simply "example.com."