-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTedSMS.pm
More file actions
40 lines (32 loc) · 1.08 KB
/
Copy pathTedSMS.pm
File metadata and controls
40 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package TedSMS;
##!/usr/bin/perl -w
use MIME::Lite;
###############################################################################
# This software is in the public domain because it contains materials
# that originally came from the United States Geological Survey,
# an agency of the United States Department of Interior. For more
# information, see the official USGS copyright policy at
# http://www.usgs.gov/visual-id/credit_usgs.html#copyright
###############################################################################
sub textSMS{
my $datetime = shift;
my @dt = localtime(time);
if( $dt[2] >= 8 && $dt[2] < 17 )
{
unless(open( MAIL, "|/usr/sbin/sendmail -t")) {
print "error.\n";
warn "Error starting sendmail $!\n";
}
else {
print MAIL "To: email@address.com\n";
print MAIL "Auto DETECTION - $datetime GMT\n";
close(MAIL) or warn "Error closing mail: $!\n";
print "Text message sent.\n";
}
}
else
{
print "Not between 8am and 5pm, not sending text.\n";
}
}
1;