You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
965 B
37 lines
965 B
use Milkbone; |
|
use Net::SMTP; |
|
|
|
use strict; |
|
use warnings; |
|
|
|
sub sendmail |
|
{ |
|
print "sending message";; |
|
my ($sub, $text, $user) = @_; |
|
$user =~ s/ /_/g; |
|
my $smtp = Net::SMTP->new(option('MonitorServer'), |
|
Hello => 'milkbone.org', Debug => 1); |
|
|
|
$smtp->auth(option("MonitorUser"), option("MonitorPass")) if option("MonitorUser"); |
|
$smtp->mail("$user\@milkbone.org"); |
|
$smtp->to('savannah@batkins.com'); |
|
|
|
$text =~ s/<.*?>//g; |
|
|
|
$smtp->data(); |
|
$smtp->datasend("To: \n"); |
|
$smtp->datasend("From: Milkbone Monitor <$user\@milkbone.org>\n"); |
|
$smtp->datasend("Subject: $user - $sub \n"); |
|
$smtp->datasend("\n"); |
|
$smtp->datasend("$user - $text"); |
|
$smtp->dataend(); |
|
|
|
$smtp->quit; |
|
} |
|
|
|
register_hook("msg_in", sub { |
|
return unless hook("protocol_away_status"); |
|
sendmail('Message Received', "Received the following message from $ARGS{-user}:\n\n$ARGS{-msg}", $ARGS{-user}); |
|
}); |
|
|
|
1;
|
|
|