[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     Re: [nocol-users] sending mail without sendmail??

Roger Burton West wrote:
> 
> On Tue, Jun 20, 2000 at 12:59:43PM -0500, Chuck Pierce wrote:
> >does anyone have a mail script (preferably written in perl) that allows you to
> >send mail to ops (using nocol) with out having sendmail installed (ie. the
> >"mail" program).  I have a machine that I want to use as the nocol monitoring
> >box, but I don't want to have sendmail/qmail installed on it.  thanks - Chuck
> 
> Have you considered using tcpwrappers and running your mail program from
> inetd?
> 
> Failing that, you'll need to open a TCP connection to your mailserver
> and handle the SMTP dialogue directly.

There's an SMTP module for perl that's part of the Net module. You use it
something like:

#!/whatever/perl

use Net::SMTP;

$smtp = Net::SMTP->new('remote.host');

$smtp->mail('nocolops'); #From address
$smtp->to('ops');
$smtp->data();
# send the mail header -- end with a blank line
$smtp->datasend("To: ops\n");
$smtp->datasend("From: nocol\n");
$smtp->datasend("\n");

#message body
$smtp->datasend("The network has croaked\n");
$smtp->dataend();
$smtp->quit;

There are a lot of options for it. If you have it installed the 'perldoc
smtp' will bring up the man pages.

-- 
  _______________________________________________________________________

    Rick Beebe                                           (203) 785-6416
    Manager, Systems & Network Engineering          FAX: (203) 785-3978
    ITS-Med Client & Technology Services         Richard.Beebe@yale.edu   
    Yale University School of Medicine                                 
    P.O. Box 208078, New Haven, CT 06520-8078
  _______________________________________________________________________