[plug] perl script

navarre at plug.linux.org.au navarre at plug.linux.org.au
Thu Jan 25 16:34:03 WST 2001


Hello Kevin

I have done many an email send from web server and never seen it done 
this way. I have always used the SMPT module in perl.

Navarre 

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 1/25/01, 4:31:47 PM, Kevin Shackleton <kevins at wn.com.au> wrote regarding 
[plug] perl script:


> We have a perl script that's supposed to run an auction and send an 
email, but
> apparently it doesn't send the email.  Anyone want to have a stab at it 
(for
> brownie points)?  I'll post them a copy of the script.  Here's a segment:

> #-#############################################
> # SUB: Send E-mail
> # Takes:
> # (To, Subject, From, Message)

> sub sendemail {
> my ($to,$from,$subject,$message) = @_;
> my $trash;
> if ($config{'mailhost'}) {
> eval('use IO::Socket; 1;')  or &oops("IO::Socket could not be loaded by 
the
> script.  Please see the script documentation for details.  It looks like 
this
> server is using perl version $].  IO::Socket may not be included with 
versions
> of perl prior to 5.00404."); # don't cause errors on machines where 
IO::Socket
> is not available
> my $remote;
> $remote = IO::Socket::INET-> new("$config{'mailhost'}:smtp(25)");
> $remote-> autoflush();
> print $remote "HELO\r\n";
> $trash = <$remote> ;
> print $remote "MAIL From: <$config{'admin_address'}> \r\n";
> $trash = <$remote> ;
> print $remote "RCPT To: <$to> \r\n";
> $trash = <$remote> ;
> print $remote "DATA\r\n";
> $trash = <$remote> ;


> K.



More information about the plug mailing list