Net::SMTP works fine on my NT servers. You can check if they're installed on your server by doing ths following:
perl -e 'use Net::SMTP;'
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.
Net::SMTP is not reliant on any underlying O/S programs, such as sendmail. It basically uses sockets to connect to the mail server. Which, incidently, could be your problem. You'll need the DNS entry or IP address of a mail server that supports SMTP, or it won't be able to send mail. If your business is running Exchange, it can easily be configured to support SMTP. A couple of settings in the admin program will set it up.
Here's even some sample code to talk to the SMTP server (I've changed the address to 127.0.0.1, you'll need to use yours)
my $globalMailServer = "127.0.0.1";
sendmail ('firstname.lastname@example.org', # put real e-mail address
'My Name Goes Here', # put your real name here
'email@example.com', # put dest e-mail address
'Leon The Peon', # put dest name here
'Your fired!', # subject
'This is some message text'); # message
@_ == 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->datasend ("To: $toname\n");
$smtp->datasend ("From: $fromname\n");
$smtp->datasend ("Subject: $subject\n");
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.
I just noticed where you said you can't install modules. Is that because you're not permitted to, or because you don't believe you can since you're not a system administrator? If it's a case of the latter, CPAN modules can be installed into a users directory, as opposed to the system directories. If it's because they won't permit you, you can always hack the code out of Net::SMTP and include it in your script, or treat it as a module (doable, but not the wisest way.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||