[Mimedefang] Access to email Headers in mimedefang-filter?

David F. Skoll dfs at roaringpenguin.com
Wed Apr 2 11:10:00 EST 2003


On Wed, 2 Apr 2003, Mark Wiater wrote:

> Specifically, if the intended recipient is X, I need to discard the email and
> send a canned message back to the original sender with canned text directing
> them to use another process to achieve their goals.

Don't do this without thinking about the consequences carefully.  What
if your auto-responder responds to another auto-responder?  You need to build
a mechanism to break loops.

> process but am running into difficulty in some instances. I have found a few
> instances where the $Sender variable does not represent a valid email
> address.

$Sender holds the argument to the SMTP "MAIL FROM:" command.  This may bear
no relation to the contents of the "From:" or "Reply-To:" field.

> If I'm not mistaken, replied-to email should be sent to the address in the
> Reply-To: or From: header information, respectively. (If this is wrong, I'd
> love to hear the right way.)

It depends on what you want to achieve.  But yes, you probably want to
use From: or Reply-To:

> If the above is correct, how can I get that data, within the confines of
> mimedefang-filter?

Open the file "./HEADERS" and read it.  It contains one header per line.

open(HDRS, "<./HEADERS");
while (<HDRS>) {
    chomp;
    if (/^From:/) {
       # Process From: header
    }
}
close(HDRS);

Regards,

David.



More information about the MIMEDefang mailing list