0

I'm rewriting all sender addresses to one address in Ppostfix.

main.cf includes this line:

sender_canonical_maps = pcre:/etc/postfix/canonical_sender

The file canonical_sender looks like this:

/.+/ name@domain.com

It works as it should and does everything I want, but I would like to understand what /.+/ does and what the difference compared to /.*/ is.

2

/.+/ is a regex that matches every string with 1 or more characters. /.*/ is a regex that matches every string with 0 or more characters.

The . matches any character, and the * and + quantifiers qualify the preceding expression to be done 0-or-more times and 1-or-more times respectively.

In the context of postfix, both seem equivalent, since I don't think it can ever reach at that point with an empty recipient (the two regex only differ in their treatment of the empty string).

  • The author of the postfix guide i'm using wrote that /.*/ leads into a loop when postfix has delivery problems and rewrites the empty bounce sender address – benjaminvonderweiden May 29 '15 at 23:12
  • If it's indeed rewriting the empty bounce address then yes, that would be pretty bad :) – Ángel May 29 '15 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.