Re: add to senders real name
am 02.04.2008 10:47:24 von skaGrant Taylor wrote:
> Use MIMEdefang to edit the From: header with in the message.
>
> I'd think a simple RegEx would do the trick "/\(From:.*\)\(<.*>.*\)/\1
> [Safe] \2/" (or the likes) should do what you are needing. (Note: I've
> never used MIMEdefang and I'm not all that familiar with Perl RegExs,
> but that will work in vim and sed so I know that it is close to what you
> need in Perl.)
If you still have problems and are using the regex above:
/\(From:.*\)\(<.*>.*\)/\1 [Safe] \2/
this is no valid perl regex, use this one:
/(From:.*)(<.*>.*)/$1 [Safe] $2/
However, in MIMEDefang you would probably need to do something like
this:
open(HEADER, 'HEADER');
while(
if(/^From:\s*(.*)\s*(<[^<]*>)/) {
my $cmt = $1;
my $addr = $2;
$cmt =~ s/^"//s; # deqote comment
$cmt =~ s/"$//s;
action_delete_all_headers('from');
action_add_header('from', "\"$cmt [SAFE]\" $addr");
last;
}
}
close HEADER;