ktpmm5
09-02-2008, 05:18 PM
I'm using a cron job to launch a perl script that grabs data out of my db and sends an email depending on the results. Had no luck with the simple perl function below - seems to work locally, but not at BH - anyone have any suggestions?
sendEmail("to\@domain.com", "from\@domain.com", "Reminder", "This is a test of the email function.");
sub sendEmail
{
my ($to, $from, $subject, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
close(MAIL);
}
sendEmail("to\@domain.com", "from\@domain.com", "Reminder", "This is a test of the email function.");
sub sendEmail
{
my ($to, $from, $subject, $message) = @_;
my $sendmail = '/usr/lib/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
close(MAIL);
}