[plug] perl script

Matt Kemner zombie at wasp.net.au
Thu Jan 25 16:48:44 WST 2001


On Thu, 25 Jan 2001 navarre at plug.linux.org.au wrote:

> 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.

I've found it easier to do something like:

sub sendemail {
  my ($to,$from,$subject,$message) = @_;
  open (MAIL, "|/usr/sbin/sendmail -t");
  print MAIL "From: $from\n";
  print MAIL "To: $to\n";
  print MAIL "Subject: $subject\n";  
  print MAIL "\n";
  print MAIL $message;
  print MAIL "\n.\n";
  close (MAIL);
}

Try replacing the "sendemail" function you posted with this one, and
changing "/usr/sbin/sendmail" with your location of sendmail.

Alternatively send me the script and I'll have a play when I have a little
time.

 - Matt




More information about the plug mailing list