Perl: Sendmail


 * 1) ! /usr/bin/perl -w
 * 2) Filename:    sendmail.pl
 * 3) Description: Simple Send Mail Script
 * 4) Usage:       perl sendmail.pl [recipients] [subject] [message]
 * 1) Usage:       perl sendmail.pl [recipients] [subject] [message]

use strict; use Mail::Sendmail;

if ($#ARGV != 2) { print "Usage: sendmail [addresses] [subject] [message]\n"; exit; }
 * 1) Print out usage

my $recipients = $ARGV[0]; my $subject = $ARGV[1]; my $message = $ARGV[2];

my %mail = (  smtp	=> "relay.cig.mot.com",  to	=> $recipients,  cc	=> "",  bcc	=> "",  from 	=> "sender\@company.com",  subject => $subject,  message => $message );
 * 1) Send Mail

sendmail(%mail);

exit;