On Tue, Jul 18, 2006 at 06:40:37PM +0200, Lucien GENTIS wrote:
[Please trim your quoting, Lucien. You quoted my .sig lines and
all text from the message. To me and many here, such is aggravating.]
Dallman Ross a écrit [edited to incorporate fixes suggested later]:
:0 w: # note flag
$DEFAULT
:0 E h
* !^FROM_DAEMON
* !^X-Loop: your(_at_)own\(_dot_)mail\(_dot_)address
* EXITCODE ?? ^^77^^
| (formail -r -I"Precedence: junk" \
-A"X-Loop: your(_at_)own(_dot_)mail(_dot_)address" ; \
echo "User over quota.") | "$SENDMAIL" $SENDMAILFLAGS -t
First, thanks for your quick answers
I tried your solutions but it seems not to work;
The main problem is, I have no admin rights and am only a user, and
we have no quota mechanism I can test, and if we did, it would still
be a different sort from yours. So I can only offer a general
concept to try out.
First test : I added in procmail.rc :
:0 w:
* ^X-Envelope-To: \/([-.a-zA-Z0-9]*)@
* MATCH ?? ()\/[^(_at_)]+
Unrelated to your main question, but that seems an odd
approach above. You're saying "zero or more alphanumeric chars
followed by a '@'." I think you should require at least one
char. Use a '+' sign instead of an asterisk. You don't need
the parens.
Btw, I need to add that an email address can contain other chars.
E.g., [_!#$%%&=] (and that's not all that are allowed). So either
you are wanting to run this particular test only on email addresses
that don't have odd chars in them (and I don't find "_" so odd,
btw), in which case you should use the test but change '*' to '+',
or you should drop the test altogether.
But unless you're worried about faked X-Envelope-To headers *and*
about their being at the top, i.e., injected by your own (hacked)
server above any possible forged header below, then the whole
test is kind of pointless. Your server put the X-Envelope-To:
header in, and it's almost certainly near the top (unless there's
something really goofy going on with your setup), and it will
only contain a valid email address. So why bother with the
alphanumerics test at all? Without it, you can do the entire
grab in one line, not two:
* ^X-Envelope-To: \/[^(_at_)]+
|/usr/local/courier-imap/bin/deliverquota -w 90
${HOME}/${DOMAIN}/${MATCH}/Maildir/
That is not going to work. You have an action line conducting your
delivery and test. That is not the same as doing it in a condition.
The "E" flag to the subsequent recipe won't be triggered if there
was no failing condition, and that is the case here. You would want
an "e" flag in this case. The "e" flag (see "man procmailrc" causes
the recipe to trigger if the failing *action* failed. (An exit code
of 77 would have that effect, I believe.)
I am assuming that your deliverquota program spits back the email
if it's not delivered? If it doesn't, then you will need to rewrite
the recipe algorithm further.
(Also, just a matter of personal taste and style, but your needless
{brackets} around all vars grates on my nerves. Well, you can use
them if you really like them, of course.) :-)
:0 E h
* !^FROM_DAEMON
* !^X-Loop: utilisateur1(_at_)domaine(_dot_)lgentis(_dot_)fr
* EXITCODE ?? ^^77^^
| (formail -r -I"Precedence: junk" \
-A"X-Loop: utilisateur1(_at_)domaine(_dot_)lgentis(_dot_)fr" ; \
echo "User over quota.") | /usr/sbin/sendmail -t -oi
What have you got against the built-in vars? $SENDMAIL is
a procmail built-in and should point there. "-oi" are
the default flags and can be referred to with "$SENDMAILFLAGS".
And procmail log said :
Matched "lucien.gentis"
procmail: Match on "()\/[^(_at_)]+"
procmail: Couldn't determine implicit lockfile from
Yes, you don't want or need the lockfile, so you should not
have invoked it. Get rid of the second colon in the recipe's
starting line.
"/usr/local/courier-imap/bin/deliverquota"
procmail: Locking ".lock"
procmail: Executing
"/usr/local/courier-imap/bin/deliverquota,-w,90,/home/vmail/domaine.lgentis.fr/lucien.gentis/Maildir/"
procmail: Program failure (77) of "/usr/local/courier-imap/bin/deliverquota"
procmail: Assigning "LASTFOLDER=/usr/local/courier-imap/bin/deliverquota
-w 90 /home/vmail/domaine.lgentis.fr/lucien.gentis/Maildir/"
procmail: Unlocking ".lock"
procmail: Locking "/var/mail/vmail.lock"
procmail: Assigning "LASTFOLDER=/var/mail/vmail"
It is visible thay second recipe is not executed;
Yes, because you had no failing conditions, as I said above. Only a failed
action. The "E" flag is useless for that. Normally, for failed actions
that need an "else", use the "e" flag.
However, you are delivering mail in the first recipe. I was not
aware of that part of the plan. Since any delivered mail won't
be passed through the rest of the .procmailrc at all -- procmail
will have exited gracefully upon delivery -- here there is no need
for an "e" flag at all.
*************************************************
so Second Test : I suppressed the 'E' flag in second recipe, and
procmail log said:
procmail: Match on ! "^X-Loop:
utilisateur1(_at_)domaine(_dot_)lgentis(_dot_)fr"
procmail: No match on "^^77^^"
procmail: Locking "/var/mail/vmail.lock"
procmail: Assigning "LASTFOLDER=/var/mail/vmail"
procmail: Opening "/var/mail/vmail"
Yet second recipe is executed, but there's no match on ^^77^^
Is not EXITCODE the exit code value of procmail itself; the value
of 77 is the exit code of deliverquota when mailbox is over
quota.
Since I can't run your program, I can't test it. I would suggest
trying it this way, then:
:0
{first recipe, which I won't repeat here}
DELQUOTA_OUT = $?
:0
{second recipe}
And use DELQUOTA_OUT in the second recipe instead of EXITCODE.
You said this was discussed before; could you tell me when it
was, I didn't find in the archives of the list
I would simply go to procmail.org and scroll down to the searchable
list and try to search for things. You can do that as well as I can,
I think. I don't have any specific memory of keywords to try, but
I'd try obvious things like "quota" and "EXITCODE".
Dallman
____________________________________________________________
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