0

I'm using postfix as a mail relay in a very simple setup, mostly with aliases, forwarding mails to GMail.

My main goal with this is to minimize the need for mailboxes on my server.

Let's assume I have the following alias

bob@mydomain.tld -> bob@gmail.com

I would like to redirect/forward all incoming mail for bob@mydomain.tld to the GMail account bob@mydomain.tld. That's the easy part.

Now for all outgoing mail sent by bob@mydomain.tld GMail offers me the feature to send mails in behalf of a different account in the settings.

However, in order for this to work, GMail needs to be able to login via SMTP for bob@mydomain.tld, which is just an alias.

Is there a way to forward incoming mails with an alias by still being able to send mails via SMTP/SASL?

mefiX
  • 101
  • 2
  • In GMail I added an account for `bob@mydomain.tld` under *settings > accounts and import > send mail as*, which only works if `bob@mydomain.tld` is an actual mailbox. The Google part is not a problem, it's simply adding an SMTP server with credentials. The postfix part is the problem. I don't want a mailbox. I just want to have an alias for **incoming** and SMTP/SASL auth for **outgoing** – mefiX Mar 14 '19 at 09:47

1 Answers1

0

Meanwhile I managed to "solve" it - at least for my own personal needs.

I added the mailbox/user/login bob@mydomain.tld in order to enable the SASL authentication for that particular user.

Then, instead of adding an alias, I added the following recipient map

bob@mydomain.tld -> bob@gmail.com

Which means I can

  1. Receive all mail with the GMail account bob@gmail.com; and
  2. SMTP login and SASL auth. as bob@mydomain.tld in order to send mail; and
  3. Do no. (2) from the GMail account

So the mailbox is there, but it won't take up any actual space, because all mail will be redirected to GMail.

mefiX
  • 101
  • 2
  • How have you done exactly, what you describe here? how have you "added the mailbox/user/login bob@mydomain.tld in order to enable the SASL authentication for that particular user." Which settings are to make in which files? – Lutz Jan 31 '22 at 12:19