OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: using original recipient in external command delivery

From: Wietse Venema (wietseporcupine.org)
Date: Sun Feb 03 2008 - 07:50:54 CST


Albert Dengg:
> hi
>
> i'm currently impleneting a solution where mail vor multiple users is
> delivered to one user using virtual_alias_maps and should then be
> processed through a procmail rule.
>
> so far, so good...
> but the problem is that an external command that get's called while
> proccessing the mail need the orignial recipient address.
>
> i'm using postfix 2.3.8 from debian, and now i have 2 questions:
> 1) is the X-Original-To header usable for that? (what happens if the
> mails for some reason already contains a X-Original-To header?)

Postfix prepends X-Original-To:, so you should use the first one.

> 2) if i won't get a stable (and upgrade-save) result this way, is there
> another way to implement this?

$ man 8 pipe
        ...
       argv=command... (required)
                ...
              In the command argument vector, the following macros are recog-
              nized and replaced with corresponding information from the Post-
              fix queue manager delivery request.
                ...
              ${original_recipient}
                     This macro expands to the complete recipient address
                     before any address rewriting or aliasing.
                        ...
                     This feature is available in Postfix 2.5 and later.

        Wietse