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 / mailaddress.al < prev    next >
Encoding:
Text File  |  2004-03-29  |  1.0 KB  |  48 lines

  1. # NOTE: Derived from blib\lib\Mail/Util.pm.
  2. # Changes made here will be lost when autosplit is run again.
  3. # See AutoSplit.pm.
  4. package Mail::Util;
  5.  
  6. #line 235 "blib\lib\Mail/Util.pm (autosplit into blib\lib\auto\Mail\Util\mailaddress.al)"
  7. sub mailaddress {
  8.  
  9.     ##
  10.     ## Return imediately if already found
  11.     ##
  12.  
  13.     return $mailaddress
  14.     if(defined $mailaddress);
  15.  
  16.     ##
  17.     ## Get user name from environment
  18.     ##
  19.  
  20.     $mailaddress = $ENV{MAILADDRESS};
  21.  
  22.     unless ($mailaddress || $^O ne 'MacOS') {
  23.     require Mac::InternetConfig;
  24.     Mac::InternetConfig->import();
  25.  
  26.     $mailaddress = $InternetConfig{kICEmail()};
  27.     }
  28.  
  29.     $mailaddress ||= $ENV{USER}    ||
  30.                      $ENV{LOGNAME} ||
  31.                      eval {getpwuid($>)} ||
  32.                      "postmaster";
  33.  
  34.     ##
  35.     ## Add domain if it does not exist
  36.     ##
  37.  
  38.     $mailaddress .= '@' . maildomain()
  39.     unless($mailaddress =~ /\@/);
  40.  
  41.     $mailaddress =~ s/(^.*<|>.*$)//g;
  42.  
  43.     $mailaddress;
  44. }
  45.  
  46. 1;
  47. # end of Mail::Util::mailaddress
  48.