>on 02/02/2001 09:13 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED] wrote:
>
>>  I am writing a CGI that I want to send a simple email notifying someone that
>>  the CGI has executed.
>>
>>  This project is a simple shoping cart that collect order info from 
>>a form and
>>  puts it into a text file on the server.  I would like to send a message to
>>  someone everytime a order is placed so they will know to check their orders.
>>  I
>>  have seen a few examples of full blown e-mail scripts, and they 
>>are HUGE!  Is
>>  there a fairly simple way to send a message to a POP3 server.
>>
>>  Josh Barton
>  > [EMAIL PROTECTED]

Mail::Sendmail.pm is pretty easy to use and has a relatively small 
footprint in my hands. Here's an example of how I might use it to 
send a message:

use Mail::Sendmail;
use CGI::Carp;

my %mail;

$mail{'smtp'}    = "mail.frii.net";
$mail{'To'}      = '"Webmaster" <[EMAIL PROTECTED]>';
$mail{'From'}    = '"Automatic Mailer" <[EMAIL PROTECTED]>';
$mail{'Subject'} = "Antenna Calculator Report";
$mail{'Message'} = "put literals and variables in here";

sendmail %mail;

carp "Send mail failed...\n$Mail::Sendmail::error\n" if $Mail::Sendmail::error;

Since it's executing in a CGI context I use CGI::Carp and carp to 
complain on errors. You can see how the real name and email address 
is encoded in the To and From fields.

Best regards,
Joseph
-- 
Joseph A. DiVerdi, Ph.D., M.B.A.
http://www.XTRsystems.com                 970.221.3982 (voice)
%PGPKeyID=('D50A9E33')                    970.224.3723 (fax)

Reply via email to