Re: procmail forward and auto-reply to the same address not working




Garen Erdoisa wrote:
rezzz wrote:
[snip]
>
Well here's the recipe I wrote, but for some reason the auto-responder
comes back repeatedly, and the actual message sent to the person is
sent repeatedly as well

:0
* ^To:.*alias@xxxxxxxxxx
{

:0 c
! real_person@xxxxxxxxxx, real_person2@xxxxxxxxxx,
real_person3@xxxxxxxxxx

This part is sending a Cc: to the listed recipients resulting in one
copy of the original message to each.


:0:
* !^X-Loop: alias@xxxxxxxxxx
| (formail -r -A "From: Someone Else<real_person4@xxxxxxxxxx>"
-A"X-Loop: alias@xxxxxxxxxx" ; cat autoreply.txt) | sendmail -t

In this recipe, formail will generate an auto-reply header based on the
original message, with the target of the reply being the address in the
Return-path: header, instead of the address in the From: header. If the
two addresses are different, then it could generate an unexpected
result. Also, procmail will stop processing the mail at this point
because the auto-reply recipe isn't using the "c" (carbon copy) flag.

The 2nd colon tells procmail to use an implied lockfile, however there
is no delivery to a file here, it's a delivery to a program, so procmail
will be unable to intuit a lockfile name.

Procmail will treat this as a delivering recipe with an action, which
may cause some other issues. Among them the original mail will be lost
to the intended recipient since formail will discard the original
message body and most of the original message headers in favor of the
auto-reply header it's being asked to generate.

If you want the auto-responder to go to the address in the From: header
use formail -rt instead of formail -r

It's also important to use the -oi switch on sendmail if you are
appending a file as the body of the message. That tells sendmail to
expect an EOF instead of a .CR. to terminate the message body.


}

any reason why this is happening?


So, all that said, here are some suggested corrections to your recipe.

:0
* ^To:.*alias@xxxxxxxxxx
{

# Send carbon copies of the incoming message to the following people
:0 c
! real_person@xxxxxxxxxx, real_person2@xxxxxxxxxx, real_person3@xxxxxxxxxx

# Generate an autoreply to the envelope sender
# Note use formail -rt to reply to the From: header instead
:0c
* !^X-Loop: alias@xxxxxxxxxx
| ( formail -r -A "From: Someone Else<real_person4@xxxxxxxxxx>" \
-A "X-Loop: alias@xxxxxxxxxx" ; \
cat autoreply.txt) | $SENDMAIL -oi -t

}

:0
$DEFAULT

Thank you for all your help!

.



Relevant Pages

  • Re: procmail forward and auto-reply to the same address not working
    ... original message, with the target of the reply being the address in the ... The 2nd colon tells procmail to use an implied lockfile, however there is no delivery to a file here, it's a delivery to a program, so procmail will be unable to intuit a lockfile name. ... Among them the original mail will be lost to the intended recipient since formail will discard the original message body and most of the original message headers in favor of the auto-reply header it's being asked to generate. ...
    (comp.mail.misc)
  • Re: Munged Headers....
    ... |> header is a text comment field and not an address. ... | invalid escapes were between the quotes. ... The most notable thing about this is that both the quotes and the commas ... Bruno, could you attach Frank's original message, as it is in _your_ ...
    (Fedora)
  • Re: IIS SMTP Virtual Server and NDR mail headers
    ... Thanks for your replies Grant and Sandy. ... headers that I want to access and can't do so in the NDR. ... the original message headers in the body so the only way I was able to get it ... to work was to add a custom header. ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: Coding Document Macro buttons
    ... Going back to your original message, a better option might be to make use of a userform. ... The feature provides macro execution with a ... with putting these "buttons" is in my header or footer. ...
    (microsoft.public.word.docmanagement)
  • Re: editing the root mail file in /var/spool/mail
    ... >> Use formail to add a received date header to each incoming mail, ... > is delivered to the $MAIL spool file. ... >> temporary files in a temporary directory and loop through ... > file with formail, discarding the old messages and writing the recent ...
    (comp.unix.shell)