[Mimedefang] $Sender -> Return-Path
David F. Skoll
dfs at roaringpenguin.com
Tue Nov 18 08:26:29 EST 2014
On Tue, 18 Nov 2014 12:01:27 +0100
Fredrik Pettai <pettai at nordu.net> wrote:
> It turns out that $Sender isn't the email address of From: header in
> those cases, instead $Sender is set to the email address of the
> Return-Path header.
Strictly speaking, $Sender is whatever the other end used in the
MAIL From:<...> SMTP command. MIMEDefang has worked this way since
the very beginning.
> I guess the question is if it's possible to avoid having Return-Path
> ending up in $Sender, or if we should do the matching against
> "$Sender" (or something else) in a different way? (We don't want to
> put in all possible Return-Path email addresses in the $Sender
> matching)
You need to parse the headers yourself to pick out the From: header
sender; you can open the file "./HEADERS" and pick out the address.
Alternatively, I believe you can get the header with:
$entity->head->get('From')
where $entity is the top-level MIME entity passed to filter_begin or
filter_end. To extract just the mail address and not any extraneous
text on the From: line, you can use the Perl module Mail::Address
which has a parse() method.
Regards,
David.
More information about the MIMEDefang
mailing list