#!/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';
|
|