<%@ Language=VBScript %> <%
'FormMail.asp written by Matt Logsdon Catalog.com
'Edit the referers line adding your domain name
'without the www
'In your form add a hidden field named recipient with the
'email address for the message to be sent to as the value
'you can add a field named sender in your form and the email
'from address will be that value other wise it will be whatever
'the recipient address is
'You can add a field called subject in your form and the
'subject of the email will be whatever you put in the subject
'field otherwise it will be "FormMail Submission"
'Adding a hidden field named thankurl will redirect the form
'to a custom url after the form is submited otherwise it will
'use a default page
'Errors:
'"Referer Mismatch" Means the email to address doesnt match
'what is in the referers
'"No Recipient Found" Means the recipient field wasnt specified
'"Error In Recipient Syntax" Means an invalid email address was
'entered in the recipient field
referers="catalog.com"
%> <%
dim valid
recipient=request.Form("recipient")
sizeof_recip=len(trim(recipient))
if sizeof_recip < 1 then
%>
|
|
|
<%
response.Write "No Recipient Found "
%>
|
|
|
|
<%
response.End
else
valid=split(recipient,"@")
if ubound(valid) < 1 then
%>
|
|
|
<%
response.Write "Error In Recipient Syntax "
%>
|
|
|
|
<%
response.End
check_recip=1
else
check_recip=2
end if
end if
if valid(1) <> referers then
%>
|
|
|
<%
response.Write "Referer Mismatch "
%>
|
|
|
|
<%
response.End
check_recip=1
end if
if check_recip > 1 then
dim newMail
dim message
dim values
Set eMail = server.CreateObject("CDONTS.NewMail")
message=""
for i = 1 to Request.Form.Count
message = message & Request.Form.Key(i) & " = " & Request.Form.Item(i) & vbCrLf & vbCrLf
next
sizeof_thankurl=len(trim(Request.Form("thankurl")))
if (sizeof_thankurl < 1) then
%>
|
|
|
<%
strMsgInfo = ""
for j = 1 to Request.Form.Count
if(Request.Form.Key(j) <> "sender") and (Request.Form.Key(j) <> "recipient") and (Request.Form.Key(j) <> "subject") then
strMsgInfo = strMsgInfo & Request.Form.Key(j) & " - " & Request.Form.Item(j) & " " & vbCrLf
end if
next
response.Write strMsgInfo
%>
|
|
|
|
<%
end if
sender=request.Form("sender")
sizeof_sender=len(trim(sender))
ck_sender=split(sender,"@")
if ((sizeof_sender < 1) or (ubound(ck_sender) < 1)) then
eMail.from = request.Form("recipient")
else
eMail.from = request.Form("sender")
end if
eMail.to = request.Form("recipient")
subject = request.Form("subject")
sizeof_subj=len(trim(subject))
if sizeof_subj < 1 then
eMail.subject = "FormMail Submission"
else
eMail.subject = request.Form("subject")
end if
eMail.body = message
eMail.send
set eMail=nothing
response.Write "Message Sent To " & request.Form("recipient")
end if
sizeof_thankurl=len(trim(Request.Form("thankurl")))
if (sizeof_thankurl > 1) then
Response.Redirect(Request.Form("thankurl"))
end if
%>
#!/usr/bin/perl ##########################################################
# Form2Email.co.uk 9 Aug 2004 # © 1999-2004 Form2Email.co.uk # Script by Alexandre
Golovkine ########################################################## # Instructions:
http://www.Form2Email.co.uk/instructions/ # FAQ: http://www.Form2Email.co.uk/faq/
########################################################## my $script_name =
'form2email.pl'; my $HTML_thankyou = 'thankyou.htm'; my $to = 'Nobody@your-url.co.uk';
my $from = 'Nobody@your-url.co.uk'; my $mailprog = '/usr/sbin/sendmail'; my
$subject = 'Web Enquiry from your-url.co.uk'; ##########################################################
my $log = '1'; my $log_name = 'mylog.txt'; my $seperator = '##### log #####';
##################################################################################
# Form2Email.co.uk © 1999 - 2004 Copyright # # The scripts are available for
private and commercial use. # # You can use the scripts in any website you build.
# # It is prohibited to sell the scripts in any format to anybody. # # The scripts
may only be distributed by Form2Email.co.uk # # The redistribution of modified
versions of the scripts is prohibited. # # Form2Email.co.uk accepts no responsibility
or liability # # whatsoever for any damages however caused when using our services
or scripts. # # By downloading and using this script you agree to the terms
and conditions. # ##################################################################################
%FORM = parse_cgi(); if($FORM{mode} eq 'admin'){ #read log file open(F, "$log_name")
or error("Can't open log-file"); local $/; my $data = ; close F; $seperator.="\n";
@data = split($seperator, $data); #delete if act=delete if ($FORM{action} eq
'delete'){ @items =split(", ", $FORM{Item}); for(@items){$Items{$_}=1;} #error($Items{1});
my $i=1; my $a=0; my @new_data; for(@data){ unless($Items{($i)}){ $new_data[$a++]
= $_ ; } $i++; } @data=@new_data; if($log){ open (LOG, ">$log_name") or error("Can't
open log file"); print LOG join("$seperator",@data); close LOG; } print "Location:
$script_name?mode=admin\n\n"; exit; } my $total = @data; my $i=1; my $txt =
qq~
"; html_text($txt); exit; } foreach(@field){$message.="$_: $FORM{$_}\n";} if($log){
my $logText; $logText="To: $to\nSubject: $subject\n"; $logText.=$message; my $logText="$seperator\n".$logText
if -f $log_name; open (LOG, ">>$log_name") or error("Can't open log file"); print
LOG $logText; close LOG; } male($to, $from, $subject, $message); print "Location:
$HTML_thankyou\n\n"; exit; sub parse_cgi{ my %FORM; my $name; my $value; my $content;
my $a=0; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer);
foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/
/; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g;
$value =~ s/<([^>]|\n)*>//g; if($FORM{$name}){$FORM{$name} = ", ".$value;} else{$FORM{$name}
= $value;} $field[$a++]=$name; } $a=0; $temp=$ENV{'QUERY_STRING'}; @pairs=split(/&/,$temp);
foreach $item(@pairs) { ($key,$content)= split (/=/,$item,2); $content =~ tr/+/
/; $content =~ s/%(..)/pack("c",hex($1))/ge; $content =~ s///g;
$content =~ s/<([^>]|\n)*>//g; if($FORM{$key}){$FORM{$key} .= ", ".$content;}
else{$FORM{$key} = $content;} $field[$a++]=$key; } return %FORM; } sub male{ open(MAIL,"|$mailprog
-t"); print MAIL "To: $_[0]\n"; print MAIL "From: $_[1]\n"; print MAIL "Subject:
$_[2]\n\n"; print MAIL "$_[3]\n"; close(MAIL); } sub get_record{ my $text = $_[0];
$text =~ s{<<(.*?)>>}{exists($INSERT{$1}) ? $INSERT{$1} : ""}gsex; return $text;
} sub html_text{ print "Content-type: text/html\n\n" unless $type; print qq|
$_[0] |; exit; } ##################################################################################
# Form2Email.co.uk © 1999 - 2004 Copyright # # The scripts are available for private
and commercial use. # # You can use the scripts in any website you build. # #
It is prohibited to sell the scripts in any format to anybody. # # The scripts
may only be distributed by Form2Email.co.uk # # The redistribution of modified
versions of the scripts is prohibited. # # Form2Email.co.uk accepts no responsibility
or liability # # whatsoever for any damages however caused when using our services
or scripts. # # By downloading and using this script you agree to the terms and
conditions. # ##################################################################################