Difference between revisions of "Perl: Sendmail"
Jump to navigation
Jump to search
(Created page with " #! /usr/bin/perl -w ############################################################################## # Filename: sendmail.pl # Description: Simple Send Mail S...") |
|||
| Line 1: | Line 1: | ||
| − | + | <pre> | |
#! /usr/bin/perl -w | #! /usr/bin/perl -w | ||
############################################################################## | ############################################################################## | ||
Revision as of 14:36, 9 March 2011
#! /usr/bin/perl -w
##############################################################################
# Filename: sendmail.pl
# Description: Simple Send Mail Script
# Usage: perl sendmail.pl [recipients] [subject] [message]
##############################################################################
use strict;
use Mail::Sendmail;
# Print out usage
if ($#ARGV != 2) {
print "Usage: send_mail addresses message\n";
exit;
}
my $recipients = $ARGV[0];
my $subject = $ARGV[1];
my $message = $ARGV[2];
# Send Mail
my %mail = (
smtp => "relay.cig.mot.com",
to => $recipients,
cc => "",
bcc => "",
from => "sender\@company.com",
subject => $subject,
message => $message
);
sendmail(%mail);
exit;