Changeset 68 for trunk


Ignore:
Timestamp:
11/12/04 16:57:59 (20 years ago)
Author:
Kris Deugau
Message:

/trunk

Fixed broken headers in mailNotify()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r66 r68  
    1515use Exporter;
    1616use Net::SMTP;
     17use POSIX;
    1718use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
    1819
    1920$VERSION        = 1.0;
    2021@ISA            = qw(Exporter);
    21 @EXPORT_OK      = qw(&connectDB &checkDBSanity &allocateBlock);
     22@EXPORT_OK      = qw(&connectDB &checkDBSanity &allocateBlock &mailNotify);
    2223
    2324@EXPORT         = (); # Export nothing by default.
    24 %EXPORT_TAGS    = ( ALL => [qw( &connectDB &checkDBSanity &allocateBlock )]
     25%EXPORT_TAGS    = ( ALL => [qw( &connectDB &checkDBSanity &allocateBlock &mailNotify)]
    2526                  );
    2627
     
    7879sub mailNotify ($$$) {
    7980  my ($recip,$subj,$message) = @_;
    80   my $mailer = new Net::SMTP "smtp.example.com";
     81  my $mailer = Net::SMTP->new("smtp.example.com", Debug => 1);
    8182
    8283  $mailer->mail('ipdb@example.com');
    8384  $mailer->to($recip);
    84   $mailer->data("X-Mailer: IPDB Notify v$IPDB::Version\n",
    85                 "Date: ".strftime("%a, %d %b %Y %H:%M:%S %z\n", localtime)."\n",
    86                 "Organization: Example Corp.",
    87                 "From: \"IP Database\" <ipdb\@example.com>\n",
    88                 "Subject: $subj\n",
    89                 "\n",
    90                 "$message\n");
     85  $mailer->data(
     86"X-Mailer: IPDB Notify v".sprintf("%.1d",$IPDB::VERSION)."\n",
     87"Date: ".strftime("%a, %d %b %Y %H:%M:%S %z",localtime)."\n",
     88"Organization: Example Corp.\n",
     89"From: \"IP Database\" <ipdb\@example.com>\n",
     90"Subject: {IPDB} $subj\n",
     91"X-Test: test\n",
     92"\n$message\n"
     93);
    9194  $mailer->quit;
    9295}
Note: See TracChangeset for help on using the changeset viewer.