SPUG: Need Help with PERL Script

Ken Zeran ken at kennethzeran.com
Thu Aug 4 14:12:50 PDT 2011


Hello- I am definitely not a programmer but I am definitely an admirer 
of those who do.
I need help. I spoke with Tim Maher and he sent me here.

I have a cgi written in PERL that processes a form that includes sending 
out email. The script works fine however it needs to be CHANGED from 
using SENDMAIL to SMTP. The HTML points to the cgi and on submit 
utilizes send_msg_to_list.

Below are those snippets from the script with references to SENDMAIL.

Can anyone help??

Thank you.

Ken
206-362-5000



Mail server is smtp.fatcow.com


send_msg_to_list

##################################

# path to sendmail
my $SENDMAIL = '/usr/sbin/sendmail';

###################################3


open (SENDMAIL, "|$SENDMAIL -t")
         or print_error ("Couldn't open [$SENDMAIL]: $!");

     my $body = &make_email_body();
     my $subject = $FORM::subject || "New Registrant to $type";

     my $counter = 0;
    print SENDMAIL <<EOF;
To: $DEFAULT_ADMIN_EMAIL_ADDRESS
From: $FROM_EMAIL_ADDRESS
Subject: $subject

New Registrant(s) to $type - Postal Code

EOF
     while ($counter != $stoppoint) {

     if ($counter == 1) { print SENDMAIL "$catname1 with $catemail1\n"; }
     if ($counter == 2) { print SENDMAIL "$catname2 with $catemail2\n"; }
     if ($counter == 3) { print SENDMAIL "$catname3 with $catemail3\n"; }
     if ($counter == 4) { print SENDMAIL "$catname4 with $catemail4\n"; }
     if ($counter == 5) { print SENDMAIL "$catname5 with $catemail5\n"; }

     $counter = $counter + 1;

     }

     close SENDMAIL;

}

################################################

open (SENDMAIL, "|$SENDMAIL -t") or print_error ("Couldn't open 
[$SENDMAIL]: $!");

$date =~ s/\n//g;

     print SENDMAIL <<EOF;
To: $DEFAULT_TO
Bcc: $emails
From: $FROM_EMAIL_ADDRESS
Subject: $subject

The following information was submitted to Apartmentresponse.com by
$FORM::email on $date ET

$body
.
EOF
     close SENDMAIL;

}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20110804/9b3eea74/attachment.html>


More information about the spug-list mailing list