Xesc Arbona wrote Thursday, October 18, 2007 6:48 PM:
[Dallman Ross wrote:]
I suggest you use X-Loop. It's canonical, it's well-documented
(see the procmailex man pages), and the header ought to persist
in this use. If you see your X-Loop, you know it's been seen
by your procmail setup and you can you can skip the cache check.
Thanks! I'll use it. However, I found another problem when
trying to add the header:
procmail: Program failure (75) of "/usr/bin/zarafa-dagent"
procmail: Assigning "LASTFOLDER=/usr/bin/zarafa-dagent xesca"
procmail: Assigning "EXITCODE=75"
procmail: Match on ! "^X-Loop: $RECIPIENT(_at_)(_dot_)*"
procmail: Executing " (formail -I Delivered-To -A "X-Loop:
$RECIPIENT(_at_)topdesk(_dot_)com") | $SENDMAIL -oi -t"
procmail: Error while writing to " (formail -I Delivered-To
-A "X-Loop: $RECIPIENT(_at_)topdesk(_dot_)com") | $SENDMAIL -oi -t"
procmail: Rescue of unfiltered data succeeded
procmail: Assigning "LASTFOLDER=/home/vmail/msg.Mkh"
procmail: Opening "/home/vmail/msg.Mkh"
If I try to pipe the message manually, it works:
cat /home/vmail/msg.Mkh | formail -I Delivered-To -A "X-Loop:
xesca(_at_)topdesk(_dot_)com") | $SENDMAIL -oi -t
What could be the problem? How can I get an even more
verbose output?
I'm having to guess at what your recipes say now. You might
want to show them to us. But the first thing you should check
is whether perhaps your mail server uses a different path/binary
and whether formail is over there.
Also, the "Rescue of unfiltered data" implies you used a flitering
recipe (f or fw in the initial line), but that's not comensurate
with sending the message out with $SENDMAIL.
Try breaking up the recipes into stages so you know just what it
is that didn't work.
:0 fw
* condition
| formail -A "X-Loop: xesca(_at_)topdesk(_dot_)com"
:0 a
*condition
! forwarding(_at_)address(_dot_)dom
for example.
--
dman
Thank you very much for your help, and sorry for not including my recipes
before. The problem was in fact that I was adding the header and sending the
message with $SENDMAIL in the same action line. Splitting them in two and
adding some fixes solved the issue. The following recipes work now for me:
## Deliver mail to PUBLIC stores
:0
* ^Delivered-To.*PUB_.*@
{
# special delivery for public folders
}
## Check duplicates
:0 Wh: $PMCACHE/$RECIPIENT.msgid.lock
* ! ^X-Loop:.*
* ! ^Delivered-To.*PUB_.*@
| formail -D 4096 $PMCACHE/$RECIPIENT.idcache
## Deliver mail to USER stores
:0 w
| $ZARAFA_DAGENT $RECIPIENT
## Error control
:0 e
{
# Get exitcode from delivery agent
:0
{ EXITCODE=$? }
# Send a copy of the mail only if not already sent,
# not a PUBlic folder and not a permament error
:0
* ! ^X-Loop:.*
* ! ^Delivered-To.*PUB_.*@
* ! EXITCODE ?? 70
{
:0 fw
| formail -I Delivered-To -a "X-Loop: $RECIPIENT(_at_)mydomain(_dot_)com"
:0 a
# Set EXITCODE=0 to not return the current message to MTA queue.
# Copied message with X-Loop will do
{ EXITCODE=0 }
:0 a
| $SENDMAIL -oi -f $SENDER $RECIPIENT
}
}
Perhaps it is not the most elegant solution, but now I can avoid duplicate
mails most of the time, and if the mailserver goes down for any reason,
messages will stay on the MTA queue until delivered.
Regards,
--
Xesc Arbona
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail