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...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | <pre> | |
#! /usr/bin/perl -w | #! /usr/bin/perl -w | ||
− | ################################################################### | + | ################################################################### |
# Filename: sendmail.pl | # Filename: sendmail.pl | ||
# Description: Simple Send Mail Script | # Description: Simple Send Mail Script | ||
# Usage: perl sendmail.pl [recipients] [subject] [message] | # Usage: perl sendmail.pl [recipients] [subject] [message] | ||
− | ################################################################### | + | ################################################################### |
use strict; | use strict; | ||
Line 12: | Line 12: | ||
# Print out usage | # Print out usage | ||
if ($#ARGV != 2) { | if ($#ARGV != 2) { | ||
− | print "Usage: | + | print "Usage: sendmail [addresses] [subject] [message]\n"; |
exit; | exit; | ||
} | } |
Latest revision as of 15:37, 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: sendmail [addresses] [subject] [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;