PDA

View Full Version : Mail Form



SeK612
02-24-2004, 11:29 PM
I need a simple mail form which users can send comments and questions to an e:mail address from. I have tried one at http://www.codebrain.com/perl/alphamail/index.html but couldn't get it to work (I kept getting "premature heading ending" errors). I would like it to be add free (nothing like the bravenet.com ones for example) and the e:mail address the information is being sent to to remain relativly anonymous (not appear in source code if possible).

Example:

Image Resized
[img]http://img19.photobucket.com/albums/v56/SeK612/mailformdemo.jpg' width='200' height='120' border='0' alt='click for full size view'> ('http://img19.photobucket.com/albums/v56/SeK612/mailformdemo.jpg')

NightStalker
02-24-2004, 11:37 PM
http://www.google.com/search?hl=en&lr=&ie=...G=Google+Search (http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=utf-8&q=mail+form&btnG=Google+Search)

or

http://hotscripts.com

SeK612
02-25-2004, 12:03 AM
Thanks :)

How come some of the scripts listed in search results on hotscripts.com have download links and others don't. How are you supposed to download the ones that don't :unsure:

balamm
02-25-2004, 12:49 AM
Cause hotscripts sucks! You gotta visit the home page for those ones and hunt around the crap for the program or script download link.

Try these links instead.

http://filesharingtalk.com/index.php?showt...ndpost&p=890557 (http://filesharingtalk.com/index.php?showtopic=101504&view=findpost&p=890557)

NightStalker
02-25-2004, 01:03 AM
Originally posted by balamm@24 February 2004 - 19:49
Cause hotscripts sucks!
<_<

HotScripts is teh shit&#33; :clap:

h1
02-25-2004, 05:44 AM
He&#39;s probably talking about the pay scripts...

SeK612
02-25-2004, 10:41 AM
What does "Premature end of script headers" mean? I&#39;ve gotten it for two .pl scripts I have tried to run :(

Is it a problem with the .pl file or with any .html files that link to it (I was unsure about directing the document to the .pl file in the cgi-bin).

Script:


#&#33;/usr/bin/perl
# location of Perl &#40;above&#41; - check your doc or ask admin

#############################################################
#
# Script Source&#58; CodeBrain.com
# Source URL&#58; http&#58;//www.codebrain.com/perl
# Script Title&#58; Alpha E-Mailer w/ Autoresponder
# Script Name&#58; AlphaMail.pl
# Copyright&#58; 1998,1999,2000 by OEC Corp & CodeBrain.com
# Version&#58; 09.01.1999.C &#40;latest&#41;
# Status&#58; Fully tested, release version 7, Y2K ready
#
# This script may not be redistributed without this header
#
# There are no restrictions on this script - anyone may use
# it, though we appreciate credit where due. Responsibility
# for use of the script is entirely with the user. Please
# note that CodeBrain.com does not support Perl scripts&#33;
#
# Instructions&#58;
#
# - Use WordPad.exe or any plain text editor to edit
# - Set your path to Perl as needed &#40;first line at top&#41;
# - Set ALL variables appropriately &#40;below, see notes&#41;
# - Take special care with the path to your sendmail &#40;below&#41;
# - Send the script to the server in ascii
# - Set script permissions - check your doc or ask admin
# - See a_faq.html for HTML set-ups in alphamail.zip file
# - Required html pages are also provided in alphamail.zip
#
#############################################################



##### SETTABLE VARIABLES ####################################

# URL to go to if there is a problem with form input
&#036;ErrorPage = &#34;http&#58;//www.yoursite.com/a_fail.html&#34;;

# URL to go to when form has been successfully submitted
&#036;ThankPage = &#34;http&#58;//www.yoursite.com/a_thanks.html&#34;;

# URL to go to if a &#39;foreign&#39; referer calls the script
&#036;EvilReferer = &#34;http&#58;//www.somesite.com&#34;;

# E-mail address to send intake form to &#40;your address&#41;
# If not using PERL 5, escape the @ thus&#58; &#092;@ instead of @
&#036;YourEmail = &#39;[email protected]&#39;;

# Script works only on your server&#40;s&#41; - &#40;&#39;URL1&#39;,&#39;URL2&#39;&#41;
@referers = &#40;&#39;www.yoursite.com&#39;,&#39;yoursite.com&#39;&#41;;

# Location of mail program - check your doc or ask admin
&#036;MailProgram = &#39;/usr/lib/sendmail&#39;;

# Subject of the e-mail autoreply to the submitter
&#036;Subject = &#34;Thanks for Your Message&#33;&#34;;

# Header line in the auto-reply message
&#036;Header = &#34;GOOBERS UNLIMITED&#34;;

# Brief tail message for body of e-mail autoreply
&#036;TailMessage = &#34;If your message requires a reply, we&#39;ll get back to you soon.&#34;;

# Your signature lines the end of the autoreply e-mail
&#036;Signature1 = &#34;John Q. Public&#34;;
&#036;Signature2 = &#34;www.YourSite.com&#34;;

##### END OF SETTABLE VARIABLES ############################



##### MAIN PROGRAM #########################################
# ___ Do not edit below this line __________________________

&CheckReferingURL;
&ReadParse;
&#036;Name = &#036;in{&#39;Name&#39;};
&#036;Email = &#036;in{&#39;Email&#39;};
&#036;Message = &#036;in{&#39;Message&#39;};
&CheckEmailAddressFormat;
&CheckFields;
&GetDate;
&SendSubmission;
&SendAutoReply;
print &#34;Location&#58; &#036;ThankPage&#092;n&#092;n&#34;;
exit;

# _________________________________________________________

sub SendSubmission {
open &#40;MAIL,&#34;|&#036;MailProgram -t&#34;&#41;;
print MAIL &#34;To&#58; &#036;YourEmail&#092;n&#34;;
print MAIL &#34;From&#58; &#036;Email&#092;n&#34;;
print MAIL &#34;Subject&#58; &#036;Subject&#092;n&#34;;
print MAIL &#34;&#036;Date&#092;n&#092;n&#34;;
print MAIL &#34;E-Mail Message&#092;n&#092;n&#34;;
print MAIL &#34;From&#58; &#036;Name&#092;n&#34;;
print MAIL &#34;Email&#58; &#036;Email&#092;n&#092;n&#34;;
print MAIL &#34;Message&#58;&#092;n&#092;n&#34;;
print MAIL &#34;&#036;Message&#092;n&#092;n&#34;;
close &#40;MAIL&#41;;
}

# _________________________________________________________

sub SendAutoReply {
open &#40;MAIL,&#34;|&#036;MailProgram -t&#34;&#41;;
print MAIL &#34;To&#58; &#036;Email&#092;n&#34;;
print MAIL &#34;From&#58; &#036;YourEmail&#092;n&#34;;
print MAIL &#34;Subject&#58; &#036;Subject&#092;n&#34;;
print MAIL &#34;&#036;Header&#092;n&#34;;
print MAIL &#34;&#036;Date&#092;n&#092;n&#34;;
print MAIL &#34;&#036;Subject&#092;n&#092;n&#34;;
print MAIL &#34;You sent the following&#58;&#092;n&#092;n&#34;;
print MAIL &#34;==============================&#092;n&#092;n&#34;;
print MAIL &#34;Name&#58; &#036;Name&#092;n&#34;;
print MAIL &#34;Email&#58; &#036;Email&#092;n&#092;n&#34;;
print MAIL &#34;Message&#58;&#092;n&#092;n&#34;;
print MAIL &#34;&#036;Message&#092;n&#092;n&#34;;
print MAIL &#34;==============================&#092;n&#092;n&#34;;
print MAIL &#34;&#036;TailMessage&#092;n&#092;n&#34;;
print MAIL &#34;Best regards,&#092;n&#092;n&#092;n&#34;;
print MAIL &#34;&#036;Signature1&#092;n&#34;;
print MAIL &#34;&#036;Signature2&#092;n&#092;n&#34;;
close &#40;MAIL&#41;;
}

# _________________________________________________________

sub GetDate {
@days = &#40;&#39;Sunday&#39;,&#39;Monday&#39;,&#39;Tuesday&#39;,&#39;Wednesday&#39;,&#39;Thursday&#39;,&#39;Friday&#39;,&#39;Saturday&#39;&#41;;
@months = &#40;&#39;01&#39;,&#39;02&#39;,&#39;03&#39;,&#39;04&#39;,&#39;05&#39;,&#39;06&#39;,&#39;07&#39;,&#39;08&#39;,&#39;09&#39;,&#39;10&#39;,&#39;11&#39;,&#39;12&#39;&#41;;
&#40;&#036;sec,&#036;min,&#036;hour,&#036;mday,&#036;mon,&#036;year,&#036;wday,&#036;yday,&#036;isdst&#41; = localtime&#40;time&#41;;
&#036;year = &#036;year+1900;
&#036;Date = &#34;&#036;days&#91;&#036;wday&#93; &#036;months&#91;&#036;mon&#93;/&#036;mday/&#036;year&#34;;
}

# _________________________________________________________

sub ReadParse { local &#40;*in&#41; = @_ if @_;
local &#40;&#036;i, &#036;key, &#036;val&#41;; if &#40; &#036;ENV{&#39;REQUEST_METHOD&#39;} eq &#34;GET&#34; &#41;
{&#036;in = &#036;ENV{&#39;QUERY_STRING&#39;};}
elsif &#40;&#036;ENV{&#39;REQUEST_METHOD&#39;} eq &#34;POST&#34;&#41;
{read&#40;STDIN,&#036;in,&#036;ENV{&#39;CONTENT_LENGTH&#39;}&#41;;}
else {
&#036;in = &#40; grep&#40; &#33;/^-/, @ARGV &#41;&#41; &#91;0&#93;;
&#036;in =~ s/&#092;&#092;&/&/g; } @in = split&#40;/&/,&#036;in&#41;;
foreach &#036;i &#40;0 .. &#036;#in&#41; {
&#036;in&#91;&#036;i&#93; =~ s/&#092;+/ /g;
&#40;&#036;key, &#036;val&#41; = split&#40;/=/,&#036;in&#91;&#036;i&#93;,2&#41;;
&#036;key =~ s/%&#40;..&#41;/pack&#40;&#34;c&#34;,hex&#40;&#036;1&#41;&#41;/ge;
&#036;val =~ s/%&#40;..&#41;/pack&#40;&#34;c&#34;,hex&#40;&#036;1&#41;&#41;/ge;
&#036;in{&#036;key} .= &#34;&#092;0&#34; if &#40;defined&#40;&#036;in{&#036;key}&#41;&#41;;
&#036;in{&#036;key} .= &#036;val; } return length&#40;&#036;in&#41;; }

# _________________________________________________________

sub CheckEmailAddressFormat {
if &#40;index&#40;&#036;Email, &#34;@&#34;&#41; &#60; 1&#41; {&DoEmailError;}
if &#40;index&#40;&#036;Email, &#34;.&#34;&#41; &#60; 1&#41; {&DoEmailError;}
if &#40;index&#40;&#036;Email, &#34; &#34;&#41; &#62; -1&#41; {&DoEmailError;}
}
sub CheckFields {
if &#40;&#33;&#036;Name || &#036;Name eq &#39; &#39;&#41; {&DoEmailError;}
if &#40;&#33;&#036;Email || &#036;Email eq &#39; &#39;&#41; {&DoEmailError;}
if &#40;&#33;&#036;Message || &#036;Message eq &#39; &#39;&#41; {&DoEmailError;}
}
sub DoEmailError {
print &#34;Location&#58; &#036;ErrorPage&#092;n&#092;n&#34;;
exit;
}

# _________________________________________________________

sub CheckReferingURL {
if &#40;&#036;ENV{&#39;HTTP_REFERER&#39;}&#41; {
foreach &#036;referer &#40;@referers&#41; {
if &#40;&#036;ENV{&#39;HTTP_REFERER&#39;} =~ /&#036;referer/i&#41; {
&#036;check_referer = &#39;1&#39;;
last;
}}}
else {&#036;check_referer = &#39;1&#39;;}
if &#40;&#036;check_referer &#33;= 1&#41; {
print &#34;Location&#58; &#036;EvilReferer&#092;n&#092;n&#34;;
exit;
}}

# _________________________________________________________

exit;

##### End of Script ########################################

vivitron 15
02-25-2004, 04:26 PM
does it have to be perl? i have a rather nice (simple) php based one

SeK612
02-25-2004, 04:44 PM
I don&#39;t mind if its PHP. The perl ones were just the first ones to come up when I searched for mail forms. So long as its not to hard to set up...

vivitron 15
02-26-2004, 12:09 AM
try the php system in this post:
http://filesharingtalk.com/index.php?showt...72&hl=mail+form (http://filesharingtalk.com/index.php?showtopic=97072&hl=mail+form)

it seems to be exactly the one i use - must&#39;ve nicked it from the same place ;)

its pretty self explanitory and you can have whatever fields in it that you want - i have a place for your name, one for your email, a drop down for "topic" and a place for the message but you can add whatever you want :)

benxuk
03-20-2004, 05:22 AM
omg what a dirty great waste of space script... what server/host you runnin on? let me know which one of these you can run and i&#39;ll cook it up

asp, cfm, php or frontpage(as in extensions), even better i can drop ya a cgi or maybe i&#39;ll put you a mailer on one of my hosts, if ya totally fukered

lmk :unsure:

h1
03-20-2004, 06:37 AM
What the hell is that Perl script? You can get the same thing done with two or three lines of PHP.

benxuk
03-20-2004, 08:29 PM
exactly