SPUG: Need Help with PERL Script

Joseph Werner telcodev at gmail.com
Thu Aug 4 15:11:35 PDT 2011


Sendmail  [usually] runs as a local daemon, and by connecting to and using
it, your script passes off some of the finer points of email processing to
that daemon [retries, for example]. While you certainly CAN connect directly
with a remote mail server using SMTP from a CGI script, I must ask if you
are prepared to beef up the CGI script to handle all of the exceptional
conditions sendmail used to handle for you?

Christian



On Thu, Aug 4, 2011 at 2:12 PM, Ken Zeran <ken at kennethzeran.com> wrote:

> **
> 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;
>
> }
>
>
>
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>     POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>    MEETINGS: 3rd Tuesdays
>    WEB PAGE: http://seattleperl.org/
>



-- 
I require any third parties to obtain my permission to submit my information
to any other party for each such submission. I further require any third
party to follow up on any submittal of my information by sending detailed
information regarding each such submission to telcodev at gmail.com
Joseph Werner
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20110804/da62e3de/attachment.html>


More information about the spug-list mailing list