Afficher un message
Vieux 02/04/2008, 10h47   #6
ska
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: add to senders real name

Grant 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(<HEADER>) {
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;
  Réponse avec citation
 
Page generated in 0,05332 seconds with 9 queries