Redirection using a 1:1 & domain wildcard alias

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Redirection using a 1:1 & domain wildcard alias

Antonio Leding

Hello Postfix Community,

First off, I apologize if answers to my questions are well-known but before posting, I did spend a fair amount of time researching all of the Postfix READMEs, HOWTOs, etc. to try and understand this but apparently I am not finding the right information.

Thanks in advance for your insights…


The scenario:

  • All domains, users, aliases, etc. are contained in SQL tables and defined in the main.cf as ‘virtual_mailbox_domains’, ‘virtual_mailbox_maps’, etc.

  • Two users are defined in the ‘virtual_mailbox_maps’ table.

    • user1_at_example.com
    • user2_at_example.com
  • There are two aliases defined in the ‘virtual_alias_maps’ table:

    • user2_at_example.com —> user1_at_example.com
    • @example.com —> user1_at_example.com

Observed behavior:

  • If I send an email to user1_at_example.com, it is delivered as expected to the user1 mailbox.

  • If I send an email to user2_at_example.com, because of the alias, it is also delivered to the user1 mailbox but not to the user2 mailbox.

    • I expected a copy of the email to also be delivered to the user2 mailbox but it appears the alias prevents this and I’m not sure not sure why.
  • However, if I remove the alias for user2, then emails sent to user2 are delivered to the user2 mailbox (which makes sense) but nothing gets delivered to user1.

    • I expected the wildcard alias (@example.com) to cause a copy of the email to also be delivered to the user1 mailbox.
  • Last, to verify that the domain wildcard alias works, emails sent to [ ANYTHING ]_at_example.com are delivered to user1_at_exmaple.com just as I expected (W00T!!!). :=)

Recap:

  • When both a 1:1 alias & a user are configured for a given email address, why are emails sent to the alias\user only delivered to the alias target?

  • When a domain wildcard alias & a user are configured, why are emails sent to the user only delivered to the user and no copy to the alias target?

Reply | Threaded
Open this post in threaded view
|

Fwd: Redirection using a 1:1 & domain wildcard alias

Antonio Leding

I made an error in my statements below under Observed behavior - the last bullet point should read:

  • Last, to verify that the domain wildcard alias works, emails sent to [ ANY_USER_OR_ALIAS_NOT_CFG’D ]_at_example.com are delivered to user1_at_exmaple.com just as I expected (W00T!!!). :=)

Forwarded message:

From: Antonio Leding [hidden email]
To: Postfix users [hidden email]
Subject: Redirection using a 1:1 & domain wildcard alias
Date: Mon, 5 Oct 2020 17:28:04 +0000

Hello Postfix Community,

First off, I apologize if answers to my questions are well-known but before posting, I did spend a fair amount of time researching all of the Postfix READMEs, HOWTOs, etc. to try and understand this but apparently I am not finding the right information.

Thanks in advance for your insights…


The scenario:

  • All domains, users, aliases, etc. are contained in SQL tables and defined in the main.cf as ‘virtual_mailbox_domains’, ‘virtual_mailbox_maps’, etc.

  • Two users are defined in the ‘virtual_mailbox_maps’ table.

    • user1_at_example.com
    • user2_at_example.com
  • There are two aliases defined in the ‘virtual_alias_maps’ table:

    • user2_at_example.com —> user1_at_example.com
    • @example.com —> user1_at_example.com

Observed behavior:

  • If I send an email to user1_at_example.com, it is delivered as expected to the user1 mailbox.

  • If I send an email to user2_at_example.com, because of the alias, it is also delivered to the user1 mailbox but not to the user2 mailbox.

    • I expected a copy of the email to also be delivered to the user2 mailbox but it appears the alias prevents this and I’m not sure not sure why.
  • However, if I remove the alias for user2, then emails sent to user2 are delivered to the user2 mailbox (which makes sense) but nothing gets delivered to user1.

    • I expected the wildcard alias (@example.com) to cause a copy of the email to also be delivered to the user1 mailbox.
  • Last, to verify that the domain wildcard alias works, emails sent to [ ANYTHING ]_at_example.com are delivered to user1_at_exmaple.com just as I expected (W00T!!!). :=)

Recap:

  • When both a 1:1 alias & a user are configured for a given email address, why are emails sent to the alias\user only delivered to the alias target?

  • When a domain wildcard alias & a user are configured, why are emails sent to the user only delivered to the user and no copy to the alias target?

Reply | Threaded
Open this post in threaded view
|

Re: Redirection using a 1:1 & domain wildcard alias

Jaroslaw Rafa
In reply to this post by Antonio Leding
Dnia  5.10.2020 o godz. 17:28:04 Antonio Leding pisze:
> * When both a 1:1 alias & a user are configured for a given email
> address, why are emails sent to the alias\user only delivered to the
> alias target?

Because that's exactly what aliases are meant for - to deliver mail to the
alias target *instead* of the original address.

If you want the mail to be delivered *both* to alias target and to the
original address, you must alias the original address to a *list* of both
these addresses (I don't know if it works for virtual_alias_maps, it
certainly works for aliases defined in /etc/aliases)

> * When a domain wildcard alias & a user are configured, why are
> emails sent to the user only delivered to the user and no copy to
> the alias target?

Because domain wildcard alias applies *by definition* for any address in
the domain that *does not have* it's own alias defined. Once an address has
it's own alias defined, wildcard alias is ignored.
--
Regards,
   Jaroslaw Rafa
   [hidden email]
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."
Reply | Threaded
Open this post in threaded view
|

Re: Redirection using a 1:1 & domain wildcard alias

Antonio Leding

Thanks Jaroslaw,

Is any of this documented anywhere? I’ve read virtual(5), virtual(8), cleanup(8), etc. ad nowhere in the observed behavior documented.

There’s discussion as to order to table searching and address matching but nothing that I’ve seen discusses what happens when there is both a user account and an alias configured nor when a user account and a domain wildcard alias are configured concurrently.

If this is all “just understood to be true”, then fine…but if so, would be far better to document this stuff…

On the flip side, if I’ve simply missed it, fair enough…just would like to know where…


On 5 Oct 2020, at 12:34, Jaroslaw Rafa wrote:

Dnia 5.10.2020 o godz. 17:28:04 Antonio Leding pisze:

* When both a 1:1 alias & a user are configured for a given email
address, why are emails sent to the alias\user only delivered to the
alias target?

Because that's exactly what aliases are meant for - to deliver mail to the
alias target *instead* of the original address.

If you want the mail to be delivered *both* to alias target and to the
original address, you must alias the original address to a *list* of both
these addresses (I don't know if it works for virtual_alias_maps, it
certainly works for aliases defined in /etc/aliases)

* When a domain wildcard alias & a user are configured, why are
emails sent to the user only delivered to the user and no copy to
the alias target?

Because domain wildcard alias applies *by definition* for any address in
the domain that *does not have* it's own alias defined. Once an address has
it's own alias defined, wildcard alias is ignored.
--
Regards,
Jaroslaw Rafa
[hidden email]
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."

Reply | Threaded
Open this post in threaded view
|

Fwd: Redirection using a 1:1 & domain wildcard alias

Antonio Leding

I found my answer - RFC-2821


Forwarded message:

From: Antonio Leding <[hidden email]>
To: Jaroslaw Rafa <[hidden email]>
Cc: [hidden email]
Subject: Re: Redirection using a 1:1 & domain wildcard alias
Date: Mon, 5 Oct 2020 20:38:00 +0000

Thanks Jaroslaw,

Is any of this documented anywhere? I’ve read virtual(5), virtual(8), cleanup(8), etc. ad nowhere in the observed behavior documented.

There’s discussion as to order to table searching and address matching but nothing that I’ve seen discusses what happens when there is both a user account and an alias configured nor when a user account and a domain wildcard alias are configured concurrently.

If this is all “just understood to be true”, then fine…but if so, would be far better to document this stuff…

On the flip side, if I’ve simply missed it, fair enough…just would like to know where…


On 5 Oct 2020, at 12:34, Jaroslaw Rafa wrote:

Dnia 5.10.2020 o godz. 17:28:04 Antonio Leding pisze:

* When both a 1:1 alias & a user are configured for a given email
address, why are emails sent to the alias\user only delivered to the
alias target?

Because that's exactly what aliases are meant for - to deliver mail to the
alias target *instead* of the original address.

If you want the mail to be delivered *both* to alias target and to the
original address, you must alias the original address to a *list* of both
these addresses (I don't know if it works for virtual_alias_maps, it
certainly works for aliases defined in /etc/aliases)

* When a domain wildcard alias & a user are configured, why are
emails sent to the user only delivered to the user and no copy to
the alias target?

Because domain wildcard alias applies *by definition* for any address in
the domain that *does not have* it's own alias defined. Once an address has
it's own alias defined, wildcard alias is ignored.
--
Regards,
Jaroslaw Rafa
[hidden email]
--
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."

Reply | Threaded
Open this post in threaded view
|

Re: Redirection using a 1:1 & domain wildcard alias

@lbutlr
In reply to this post by Jaroslaw Rafa
On 05 Oct 2020, at 13:34, Jaroslaw Rafa <[hidden email]> wrote:

> Dnia  5.10.2020 o godz. 17:28:04 Antonio Leding pisze:
>> * When both a 1:1 alias & a user are configured for a given email
>> address, why are emails sent to the alias\user only delivered to the
>> alias target?
>
> Because that's exactly what aliases are meant for - to deliver mail to the
> alias target *instead* of the original address.
>
> If you want the mail to be delivered *both* to alias target and to the
> original address, you must alias the original address to a *list* of both
> these addresses (I don't know if it works for virtual_alias_maps, it
> certainly works for aliases defined in /etc/aliases)

Yes, and you can use /etc/aliases to define a group for a sql address. For example, I have an email address setup for the dogs, where all the vet mail gets and it is the email address on their tags as well. I want that email to go to both my personal address and to my wife's personal address:

[hidden email]  [hidden email], [hidden email]

Where both addresses on the right are defined in sql databases. (We have quite a lot of email addresses like this)

I find this a lot easier to maintain than editing the database from a ssh session as I am unwilling to expose the user database to any web-based SQL editor.



--
THEY ARE LAUGHING AT ME, NOT WITH ME Bart chalkboard Ep. 7G12