The FAQ tip at http://www.sendmail.org/faq/section3#3.29 seems to rely on the fact that the following entry in virtusertable:
will cause $1 in the .procmailrc config, e.g.:
to have the value "xyz" if email received was for email@example.com and "abc" for firstname.lastname@example.org. (Viewing the procmail log seems to confirm this.)
However, I'd like to have $1 have the value "email@example.com" instead. This is so I can do processing for multiple domain names under the same user.
The following virtusertable/.procmailrc config seems to work for this purpose:
@domain1.com userA+%1\@domain1.com @domain2.com userA+%1\@domain2.com
ENV_TO=$1 :0f * ENV_TO ?? . | formail -i "X-Envelope-To: $ENV_TO" :0fE | formail -i "X-Envelope-To: UNKNOWN" :0: * ^X-Envelope-To: xyz\\@domain1.com $HOME/userA/domain1.com/mail/xyz :0: * ^X-Envelope-To: abc\\@domain2.com $HOME/userA/domain2.com/mail/abc
However, I'd like to avoid having to the double backslashes appear in X-Envelope-To. Removing [what seems to be] the quoting backslash in the virtusertable fails, e.g.:
@domain1.com userAfirstname.lastname@example.org @domain2.com userAemail@example.com
seems to cause an "excessive recursion error".
My question is:
How does one properly quote the at-sign in virtusertable, so that $1 that arrives in .procmailrc will only contain "firstname.lastname@example.org" rather than "abc\@domain1.com"?
Or, if that is not possible, how can we remove the backslash within .procmailrc processing itself so that ENV_TO is (ultimately) assigned "email@example.com" rather than "abc\@domain1.com"?