[Mimedefang] Detecting and adding headers if attachment found.
Bryan Martin
mimedefang at lloydbuxton.com
Sat May 1 10:30:00 EDT 2004
A lame newbie questions but here we go.
My intentions are to have procmailrc copy any message which has an
attachment to a certain directory but I need to have mimedefang add a header
to label it as such. This way I can see what files are being blocked and if
any adjustments need to be made.
I come from a windows background so I attempted to add a "global variable"
to the top of the "mimedefang-filter" located in "/etc/mail". With that I
had plans to make the global variable on/off to indicate whether or not
mimedefang found an attachment. I added this at the top "$invalidAttachment
= "No";" which to me indicates a global variable being defined with "No" as
the default value. Next inside the "filter" sub inside the "if
(filter_bad_filename($entity)) {" block I added "$invalidAttachment =
"Yes";" to indicate that an attachment has been found. Later inside the
"filter_end" I added a statement like this:
# BM 4/28/04 - Attempt to check for attachments
if (my($invalidAttachment) eq "Yes"){
action_add_header("X-Attachment-Removed",
"$invalidAttachment");
add_recipient($AdminAddress);
}else{
action_add_header("X-Attachment-Removed",
"$invalidAttachment");
}
However, the message always comes in with "X-Attachment-Removed" equaling
nothing. Can someone help me out?
More information about the MIMEDefang
mailing list