3 # modified from pager.pm in flooterbuck
12 use Mail::Mailer qw(sendmail);
21 &main::status("page module requires Mail::Mailer.");
22 return 'page module not active';
24 unless ($message =~ /^(\S+)\s+(.*)$/) {
32 my $tofactoid = &::getFactoid("${to}'s pager");
33 if ($tofactoid =~ /(\S+@\S+)/) {
35 $toaddr =~ s/^mailto://;
37 my $fromfactoid = &::getFactoid("${from}'s pager");
40 if ($fromfactoid =~ /(\S+@\S+)/) {
42 $fromaddr =~ s/^mailto://;
44 $fromaddr = 'infobot@example.com';
47 my $channel = $::chan || 'infobot';
49 &main::status("pager: from $from <$fromaddr>, to $to <$toaddr>, msg \"$msg\"");
51 To => "$to <$toaddr>",
52 From => "$from <$fromaddr>",
53 Subject => "Message from $channel!",
54 'X-Mailer' => "blootbot",
58 #for (keys %headers) {
59 # $logmsg .= "$_: $headers{$_}\n";
61 #$logmsg .= "\n$msg\n";
62 #&main::status("pager:\n$logmsg");
65 my $mailer = new Mail::Mailer 'sendmail';
66 $failed++ unless $mailer->open(\%headers);
67 $failed++ unless print $mailer "$msg\n";
68 $failed++ unless $mailer->close;
71 $retval='Sorry, an error occurred while sending mail.';
73 $retval="$from: I sent mail to $toaddr.";
76 $retval="Sorry, I don't know ${to}'s email address.";
78 &::performStrictReply($retval);