Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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, you'll need to use yours)
#!/usr/local/bin/perl -w use strict; use Net::SMTP; my $globalMailServer = ""; { sendmail ('', # put real e-mail address + here 'My Name Goes Here', # put your real name here '', # 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; }
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.


Update: 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.)

e-mail jcwren

In reply to (jcwren) Re: Sending mail on NT by jcwren
in thread Sending mail on NT by zdog

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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:
    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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [Lotus1]: I was here

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (11)
    As of 2018-06-18 17:55 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (110 votes). Check out past polls.