Jeff Weinberger a écrit : > Hi: > > After reading http://www.irbs.net/internet/postfix/0703/1471.html and > http://www.irbs.net/internet/postfix/0703/1519.html to help with my > autoreply capability (and making sure i get it as close to "right" as > possible!), I am trying to ensure that I can take all reasonable > measures to get the autoreplies right (when they are sent). to this end, > it's important that I capture the envelope-sender of each message in > addition to the "From:" header, but I am having difficulty doing so. >
yes, don't reply to From: addresses. if you can't get the envelope sender, don't autoreply. > I have tried to send the message to my autoreply script via bcc: (via > always_bcc or recipient_bcc_maps) to a local autoreply address which > then has the transport autoreply: which calls the autoreply script via > pipe or is a local alias that resolves to '|/path/to/autoreply/script'. > The transport mechanism has the ability to pass information from > postfix, but doesn't seem to capture the envelope-sender correctly. > The envelope sender should be found in the Retrun-Path header. when using a pipe, make sure to put the 'R' flag in the "flags=..." options. you can also use -f ${sender} in your pipe and have your scrpit parse command line args. > I have tried using every single one of the macros listed in > http://www.postfix.com/pipe.8.html to no avail. I have even used some > macros that are not listed, but I've found in other examples as I've > searched for solutions. > > This happens with mail sent to alias addresses as well as virtual > mailboxes. > > Some e-mails from lists to which I subscribe include a "Sender: " header > which looks like it contains the envelope-sender. Mail that shows up in > my standard ISP account (not ever touching my postfix installation) > seems to include the "Return-Path: " header which includes the > envelope-sender. > > Leading me to two questions: > > 1) on-topic: How can I be sure I can find the envelope-sender for every > message and pass that to my script? Or maybe I should ask it this way: > How do I get postfix to keep the correct envelope-sender? > always_bcc does not change the envelope sender (it changes the envelope recipient). so you get the "correct" envelope sender. > 2) broader: Is the list of macros that can be used as arguments to a > pipe command (as listed in http://www.postfix.com/pipe.8.html) complete? > or are there others (like the ones I've found)? and where can I find a > complete list? > > I would appreciate any help, direction or pointers that anyone can offer. > > It might help to know that messages entering my postfix server are then > passed to a content_filter (Dspam, specifically, using > content_filter=dspam:dspam), which then re-injects them back into > postfix which then handles them and sends them to a delivery agent > (mostly maildrop, sometimes virtual). If the order of this (and the > passing through dpsam is affecting the envelope-sender, is there way to > either get the message to the autoreply script before it goes to dspam > (I don't want that, since I don't autoreply to spam messages) or a way > to pass the envelope-sender through dpsam, or something else I haven't > considered? > check your logs to see if the envelope sender is present at delivery time. if your content filters and other stuff reinjects mail using the sendmail command, make sure to use -f to passe the (original) envelope-sender.