Changeset 197


Ignore:
Timestamp:
12/12/11 17:57:31 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Prepare for spamming! Add mailNotify() stolen and trimmed back from
https://secure.deepnet.cx/svn/ipdb/cgi-bin/IPDB.pm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r196 r197  
    3838        &domStatus &importAXFR
    3939        &export
     40        &mailNotify
    4041        %typemap %reverse_typemap %config
    4142        %permissions @permtypes $permlist
     
    5758                &domStatus &importAXFR
    5859                &export
     60                &mailNotify
    5961                %typemap %reverse_typemap %config
    6062                %permissions @permtypes $permlist
     
    20462048
    20472049
     2050## DNSDB::mailNotify()
     2051# Sends notification mail to recipients regarding an IPDB operation
     2052sub mailNotify {
     2053  my $dbh = shift;
     2054  my ($subj,$message) = @_;
     2055
     2056  return if $config{mailhost} eq 'smtp.example.com';   # do nothing if still using default SMTP host.
     2057
     2058  my $mailer = Net::SMTP->new($config{mailhost}, Hello => "dnsadmin.$config{domain}");
     2059
     2060  my $mailsender = ($config{mailsender} ? $config{mailsender} : $config{mailnotify});
     2061
     2062  $mailer->mail($mailsender);
     2063  $mailer->to($config{mailnotify});
     2064  $mailer->data("From: \"$config{mailname}\" <$mailsender\n",
     2065        "To: $config{mailnotify}\n",
     2066        "Date: ".strftime("%a, %d %b %Y %H:%M:%S %z",localtime)."\n",
     2067        "Subject: $subj\n",
     2068        "X-Mailer: DNSAdmin Notify v".sprintf("%.1d",$DNSDB::VERSION)."\n",
     2069        "Organization: $config{orgname}\n",
     2070        "\n$message\n");
     2071  $mailer->quit;
     2072}
     2073
    20482074# shut Perl up
    204920751;
Note: See TracChangeset for help on using the changeset viewer.