The FAQ tip at http://www.sendmail.org/faq/section3#3.29 seems to rely on the fact that the following entry in virtusertable:
@domain.com user+%1
will cause $1 in the .procmailrc config, e.g.:
ENV_TO=$1
to have the value "xyz" if email received was for xyz@domain.com and "abc" for abc@domain.com. (Viewing the procmail log seems to confirm this.)
However, I'd like to have $1 have the value "xyz@domain.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:
virtusertable:
@domain1.com userA+%1\@domain1.com
@domain2.com userA+%1\@domain2.com
.procmailrc:
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 userA+%1@domain1.com
@domain2.com userA+%1@domain2.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 "abc@domain1.com" 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 "abc@domain1.com" rather than "abc\@domain1.com"?