Ok, so there are no procmail recipe nerds here, eh? That's ok.. I ended up asking this question on the procmail mailing list, and received very adequate answers. Here is what was learned:
Code:
:0 c: toolarge.lock
Issue #1:
The filelocking is unnecessary.
Why: The email is never sent to a file nor mailbox. No need to lock anything.
Issue #2:
The carbon copy is unecessary.
Why: Once the email is sent to sendmail/formail, the rule does not need to send the email to /dev/null, because it's already been dealt with. This will only produce wasted processing time.
Issue #3:
The 'h' header-only flag is needed.
Why: Without it, the entire email, header and body, are being sent to formail, causing a delay as the emails-in-question are over 5meg in size. Formail only handles the header, and stops accepting input once the header receipt is complete. Procmail then sees that the entire email was not read, and triggers an error. This is why I was getting an error in my log file.
Final line should be:
Next segment:
Code:
| (/usr/bin/formail -r -A "X-Loop: ourdomain.com"; \
cat /etc/messagetoobig.txt) | $SENDMAIL -t -frejection_notice
Issue #1:
Full path to formail is unnecessary.
Why: The build-in path's will locate the binary. It doesn't hurt to have it, but it is not necessary.
Issue #2:
$SENDMAIL is missing $SENDMAILFLAGS.
Why: Honestly, I don't know how necessary this is. (=
Final line should be:
Code:
| (formail -r -A "X-Loop: ourdomain.com"; \
cat /etc/messagetoobig.txt) \
| $SENDMAIL $SENDMAILFLAGS -t -frejection_notice
And finally:
Issue #1:
Filelocking on /dev/null is unnecessary.
Why: Race conditions cannot exist on a device that cannot return anything.
Issue #2:
Whole rule is unnecessary.
Why: Without the 'c' carbon-copy flag, this rule is no needed. Delete it.
In the end, we end up looking like this:
Code:
:0
* > 7000000
* !^FROM_DAEMON
* !^X-Loop: ourdomain.com
{
LOG="Reason: Message over 5meg in size. Refusing
"
:0 h
| (formail -r -A "X-Loop: ourdomain.com"; \
cat /etc/messagetoobig.txt) \
| $SENDMAIL $SENDMAILFLAGS -t -frejection_notice
}
And no error message! Yay!!