3 # modified from pager.pm in flooterbuck changes are:
5 # Copyright (c) 2004 Tim Riker <Tim@Rikers.org>
7 # This package is free software; you can redistribute it and/or
8 # modify it under the terms of the license found in the file
9 # named LICENSE that should have accompanied this file.
11 # THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
12 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22 use Mail::Mailer qw(sendmail);
31 &main::status("page module requires Mail::Mailer.");
32 return 'page module not active';
34 unless ($message =~ /^(\S+)\s+(.*)$/) {
42 my $tofactoid = &::getFactoid("${to}'s pager");
43 if ($tofactoid =~ /(\S+@\S+)/) {
45 $toaddr =~ s/^mailto://;
47 my $fromfactoid = &::getFactoid("${from}'s pager");
50 if ($fromfactoid =~ /(\S+@\S+)/) {
52 $fromaddr =~ s/^mailto://;
54 $fromaddr = 'infobot@example.com';
57 my $channel = $::chan || 'infobot';
59 &main::status("pager: from $from <$fromaddr>, to $to <$toaddr>, msg \"$msg\"");
61 To => "$to <$toaddr>",
62 From => "$from <$fromaddr>",
63 Subject => "Message from $channel!",
64 'X-Mailer' => "blootbot",
68 #for (keys %headers) {
69 # $logmsg .= "$_: $headers{$_}\n";
71 #$logmsg .= "\n$msg\n";
72 #&main::status("pager:\n$logmsg");
75 my $mailer = new Mail::Mailer 'sendmail';
76 $failed++ unless $mailer->open(\%headers);
77 $failed++ unless print $mailer "$msg\n";
78 $failed++ unless $mailer->close;
81 $retval='Sorry, an error occurred while sending mail.';
83 $retval="$from: I sent mail to $toaddr from $fromaddr.";
86 $retval="Sorry, I don't know ${to}'s email address.";
88 &::performStrictReply($retval);