home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / _prephdr.al < prev    next >
Encoding:
Text File  |  2004-03-29  |  1.1 KB  |  44 lines

  1. # NOTE: Derived from blib\lib\Mail/Internet.pm.
  2. # Changes made here will be lost when autosplit is run again.
  3. # See AutoSplit.pm.
  4. package Mail::Internet;
  5.  
  6. #line 525 "blib\lib\Mail/Internet.pm (autosplit into blib\lib\auto\Mail\Internet\_prephdr.al)"
  7. sub _prephdr {
  8.  
  9.     use Mail::Util;
  10.  
  11.     my $hdr = shift;
  12.  
  13.     $hdr->delete('From '); # Just in case :-)
  14.  
  15.     # An original message should not have any Received lines
  16.  
  17.     $hdr->delete('Received');
  18.  
  19.     $hdr->replace('X-Mailer', "Perl5 Mail::Internet v".$Mail::Internet::VERSION)
  20.         unless $hdr->count('X-Mailer');
  21.  
  22.     my $name = eval {local $SIG{__DIE__}; (getpwuid($>))[6]} || $ENV{NAME} ||"";
  23.  
  24.     while($name =~ s/\([^\(\)]*\)//) { 1; }
  25.  
  26.     if($name =~ /[^\w\s]/) {
  27.     $name =~ s/"/\"/g;
  28.     $name = '"' . $name . '"';
  29.     }
  30.  
  31.     my $from = sprintf "%s <%s>", $name, Mail::Util::mailaddress();
  32.     $from =~ s/\s{2,}/ /g;
  33.  
  34.     my $tag;
  35.  
  36.     foreach $tag (qw(From Sender)) {  # Sender is deprecated
  37.     $hdr->add($tag,$from)
  38.         unless($hdr->get($tag));
  39.     }
  40. }
  41.  
  42. # end of Mail::Internet::_prephdr
  43. 1;
  44.