[Mimedefang] Filtering Sender name

Jason Englander jason at englanders.cc
Thu Jan 23 15:23:01 EST 2003


On Thu, 23 Jan 2003, Julian Monteiro wrote:

> I was using until now the $Sender variable in filter_begin function, but
> the content is allways a already parsed e-mail address (like xxx at yyy.com
> ), but I want the whole Sender name (like My Name is xxx <xxx at yyy.com>).
>
> I tried to read ./SENDER file, but it appear to be empty.

Read in the HEADERS file (see 'man mimedefang-protocol') and get the From:
header from there.  The $Sender is totally different, that's the envelope
sender.  For example, right now the message you're reading from me has a
$Sender of "mimedefang-admin at lists.roaringpenguin.com", but a From: of
"Jason Englander <jason at englanders.cc>".

open (HEADERS, "./HEADERS");
while (<HEADERS>) {
  if ($_ =~ /^From: /) {
    # Do something
    last;
  }
}
close (HEADERS);

For parsing you might want to pass that through Mail::Address.

  Jason

-- 
Jason Englander <jason at englanders.cc>
394F 7E02 C105 7268 777A  3F5A 0AC0 C618 0675 80CA




More information about the MIMEDefang mailing list