Sending mail from a web page using a cgi-bin program

To send mail from a cgi-bin program, you should keep the following points in mind: Below is sample perl code for sending mail. It assumes you are using perl revision 5.
## ****** BEGIN SAMPLE PERL CODE TO SEND MAIL # When this code is entered, the following variables must already be set: # $to recipient, or comma-separated list of recipients # $from desired From: line # $errors address to which delivery errors should be sent; may be # same as $from # $subject desired Subject: line # Invoke sendmail as a subprocess. -t means read addressees from # standard input. -oi means don't let a single dot terminate input. # -f sets envelope sender for error bounces. if (! open(SENDMAIL, "|/usr/sbin/sendmail -f $errors -oi -t")) { warn "error invoking sendmail: $!\n"; } else { # send headers to sendmail, must end with empty line print SENDMAIL < }


To a2i communications home page


$Id: webmail.html,v 1.9 2002/11/01 11:31:30 lrdroot Exp $
$Source: /mi/home/guest/www/howto/RCS/webmail.html,v $