Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use Net::SMTP; use CGI qw(:standard); #---------------Configuration section----------------# $to="info\@domainname"; #---------------Configuration section ends-----------# #--------------Initialization section----------------# $name=param("name"); $surname=param("surname"); $subject=param("subject"); $comments=param("comments"); $company=param("company"); $phone=param("phone"); $fax=param("fax"); $email=param("email");; #--------------Initialization section ends-----------# ###### required fields check $check=1; if (!$name) {$check="0";} elsif (!$surname) {$check="0";} elsif (!subject) {$check="0";} elsif (!email) {$check="0";} else { ###### required fields check ends here $smtp = Net::SMTP->new('localhost'); $smtp->mail("Mail from Website"); $smtp->to("$to"); $smtp->data(); $smtp->datasend("FROM: Mail from Website\n"); $smtp->datasend("TO: $to\n"); $smtp->datasend("SUBJECT: $subject\n"); $smtp->datasend("\n"); $smtp->datasend("NAME: $name\n"); $smtp->datasend("SURNAME: $surname\n"); $smtp->datasend("SUBJECT: $subject\n"); $smtp->datasend("COMMENTS:\n\n$comments\n\n"); $smtp->datasend("COMPANY: $company\n"); $smtp->datasend("PHONE: $phone\n"); $smtp->datasend("FAX: $fax\n"); $smtp->datasend("E-MAIL: $email\n"); $smtp->dataend(); $smtp->quit; } if ($check=="0") { print "Content-type: text/html;", "\n\n"; print << 'ERRORMSG'; <html> <head> <title> E-mail status </title> <style type="text/css"> P {font-family: Arial; font-size: 14pt;font-weight: bold; color: #353B +37;} </style> </head> <body bgcolor="#ffffff"> <table width="100%" height="100%"> <tr> <td align="center"><P><img src="images/error.jpg" border="0" h +space="0" vspace="0">Please Fill All REQUIRED Forms<br><br><P><img src="images/error.jpg" border="0" hspace="0" vspa +ce="0">Παρακαλώ συμπληρώσατε όλα τα απαιτούμενα πεδία</P></td> </tr> </table> </body> </html> ERRORMSG } else { print "Content-type: text/html;", "\n\n"; print << 'OKMSG'; <html> <head> <title> E-mail status </title> <style type="text/css"> P {font-family: Arial; font-size: 14pt;font-weight: bold; color: #353B +37;} </style> </head> <body bgcolor="#ffffff"> <table width="100%" height="100%"> <tr> <td align="center"><P><img src="images/ok.jpg" border="0" hspace=" +0" vspace="0"> Message sent successfully<br><br><img src="images/ok.jpg" bord +er="0" hspace="0" vspace="0">To E-mail σας στάλθηκε επιτυχώς</P> </td> </tr> </table> </body> </html> OKMSG }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SMTP - too much delay...
by Anonymous Monk on Aug 12, 2002 at 08:36 UTC | |
|
Re: Net::SMTP - too much delay...
by fsn (Friar) on Aug 12, 2002 at 09:12 UTC | |
by Anonymous Monk on Aug 12, 2002 at 10:45 UTC | |
|
Re: Net::SMTP - too much delay...
by Anonymous Monk on Aug 12, 2002 at 08:30 UTC |