Sample scripts - PERL Mail Script for Linux
 
           
Perl mail script  ASP mail script ASP Hit Counter Script  SQL connectivity  MySQL connectivity

 

The following is the Sample Form Code and followed by the PERL script :
 
                    PERL Code
 

#!/usr/bin/perl 
print "Content-type: text/html\n\r\n\r"; 
use Mail::Sendmail 0.75; 
# Read from the sandard input 
read(STDIN,$query,$ENV{'CONTENT_LENGTH'}); 
$input = parseQs($query); 
print("To --- $input->{to} <br>"); 
print("cc --- $input->{cc} <br>"); 
print("message --- $input->{message}<br>"); 
$message=$input->{message}; 
print("submit --- $input->{submit}<br>"); 
$head="This is a multi-part message in MIME format."; 
$head=$head."Content-Type: text/plain; charset=us-ascii"; 
$head=$head."Content-Transfer-Encoding: 7bit"; 
# Mailing pare from here 
#print "Content-type: text/html\n\r\n\r"; 
%mail = ( SMTP => 'smtp.websuvidha.com' , From
=>'nagender@websuvidha.com', To 
=>$input->{to},Subject =>
$input->{sub},Message=>$input->{message} ); 
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n"; 
print ("ypur message has been sent"); 

#------------------------- 
sub parseQs{ 
my $query= shift; 
my (%input,@elements,$element,$key,$value ); 
@elements=split(/&/,$query); 
for $element(@elements) { 
$element =~ tr/+/ /; 
($key,$value)=split(/=/,$element); 
$key =~ s/%([\dA-Fa-f]{2})/pack("C",hex($1))/ge; 
$value =~ s/%([\dA-Fa-f]{2})/pack("C",hex($1))/ge; 
if (defined $input{$key}) { 
$input{$key} .= "\0$value"; 

else { 
$input{$key}=$value; 



\%input; 
}

 
| Buy domain names | Windows Hosting | Linux Hosting | Email | Acceptable Use Policy |       
Copyright © 2000 - 2005 websuvidha.com. All Rights Reserved.