in reply to Sending mail on NT
If you get an error to the effect that it can't find them, then they're indeed not installed. However, that shouldn't stop you from installing them. Since most NT systems really aren't setup for security (like Linux boxes), you could just hop on over to CPAN and fetch them. I think the Net::SMTP is a pure Perl module, so you shouldn't need a compiler to install it. You may have to grab a copy of make, nmake or dmake from somwhere however.perl -e 'use Net::SMTP;'
This subroutine is a direct extract from some code around here. I also just tested this code, so it should work for you, if you fix the mail server address.#!/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; }
|
|---|