#!/usr/local/bin/perl -w use strict; use Net::SMTP; my $globalMailServer = "127.0.0.1"; { sendmail ('you@address.com', # put real e-mail address here 'My Name Goes Here', # put your real name here 'peon@company.com', # put dest e-mail address here 'Leon The Peon', # put dest name here 'Your fired!', # subject 'This is some message text'); # message } sub sendmail { @_ == 6 or die "Improper number of arguments"; my ($fromemail, $fromname, $toemail, $toname, $subject, $message) = @_; my $smtp = 0; $smtp = Net::SMTP->new($globalMailServer) or die "Can't connect to mail server named '$globalMailServer'\n"; $smtp->mail ($fromemail); $smtp->to ($toemail); $smtp->data (); $smtp->datasend ("To: $toname\n"); $smtp->datasend ("From: $fromname\n"); $smtp->datasend ("Subject: $subject\n"); $smtp->datasend ("\n"); $smtp->datasend ($message); $smtp->dataend (); $smtp->quit; }