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 # allow optional trailing : ie: page foo[:] hello
45 my $tofactoid = &::getFactoid("${to}'s pager");
46 if ($tofactoid =~ /(\S+@\S+)/) {
48 $toaddr =~ s/^mailto://;
50 my $fromfactoid = &::getFactoid("${from}'s pager");
53 if ($fromfactoid =~ /(\S+@\S+)/) {
55 $fromaddr =~ s/^mailto://;
57 $fromaddr = 'infobot@example.com';
60 my $channel = $::chan || 'infobot';
62 &main::status("pager: from $from <$fromaddr>, to $to <$toaddr>, msg \"$msg\"");
64 To => "$to <$toaddr>",
65 From => "$from <$fromaddr>",
66 Subject => "Message from $channel!",
67 'X-Mailer' => "blootbot",
71 # for (keys %headers) {
72 # $logmsg .= "$_: $headers{$_}\n";
74 # $logmsg .= "\n$msg\n";
75 # &main::status("pager:\n$logmsg");
78 my $mailer = new Mail::Mailer 'sendmail';
79 $failed++ unless $mailer->open(\%headers);
80 $failed++ unless print $mailer "$msg\n";
81 $failed++ unless $mailer->close;
84 $retval='Sorry, an error occurred while sending mail.';
86 $retval="$from: I sent mail to $toaddr from $fromaddr.";
89 $retval="Sorry, I don't know ${to}'s email address.";
91 &::performStrictReply($retval);