[Javascript] mailto link question.

Brian Gordon microsteel at adelphia.net
Fri Oct 17 09:09:20 CDT 2003


> Looks like a nice script; however for a purpose such as this it's usually
> best to utilize something that does referrer checking and such.  It really
> sucks to have people from other websites use your script to send their
> e-mail.  FormMail by Matthew Wright works quite well and is very
> customizable - especially if you've already got some programming
> experience.

Well, if you mean to make it private, its easy just to put it in an
htpasswd-protected subfolder. And if you mean to have it be a "feedback"
kind of form, just delete "in{'recip'} in the header and replace it with
your at email.com. Simply change the cc, bcc, and subject to the things you
want, in quotes.

There is also a feature that I forgot to previously mention:
you either need to have a checkbox labeled "Should the sender be anonymous?"
with the name "priv" or you need to delete this out of the program:

if($in{'priv'} eq "on")
{
print MAIL "To: $to\n";
print MAIL "CC: $cc\n";
print MAIL "BCC: $bcc\n";
print MAIL "Reply-To: anonymous\@server.com\n";
print MAIL "From: anonymous\@server.com\n";
print MAIL "Subject: $in{'sub'}\n\n";
}
else
{

and then the } after print MAIL "Subject: $subj\n\n"; needs to be deleted.
You probably want to change the goonlagoon footer that appears at the bottom
of every email, too.

Here is a perl script written specifically for feedback:


#!/usr/local/bin/perl
require "cgi-lib.pl";
&ReadParse;
$mailprog = '/var/qmail/bin/qmail-inject';
$fakemail = 'feedback at goonlagoon.hypermart.net';
if($in{'comments'} eq "")
{
$comm = 'The user had no comments to share.';
}
else
{
$comm = $in{'comments'};
}
if($in{'priv'} eq "on")
{
$priv = 'like to have private access.';
}
else
{
$priv = 'not like to have private access.';
}
if($in{'aff'} eq "on")
{
$aff = 'like to become an affilate.';
$ex = 'Please fill out the form again, but make your country AFFILATE and
put your web design experience in the comments section. Do not recheck the
box.';
}
else
{
$aff = 'not like to become an affilate.';
$ex = '';
}
print &PrintHeader;
unless (-e $mailprog)
{
print <<"PrintTag";
<HTML><BODY>
<H3>Cannot find $mailprog.</H3>
<P>There is a typo in the mail program path.</P>
</BODY></HTML>
PrintTag
exit(0);
}
print <<"PrintTag";
<HTML><HEAD>
<TITLE>Thanks for responding!</TITLE>
</HEAD>
<BODY BGCOLOR="white" TEXT="black">
<H2>Thank You!</H2>
Thanks for filling out my form.<br>
<P>I will respond as soon as possible.</P>
$ex<br>
<p><a href=http://goonlagoon.hypermart.net>Back to home</a>&nbsp;|&nbsp;<a
href=http://goonlagoon.hypermart.net/emailme.html>Email me again</a></p>
</body></html>
<noscript><noscript><noscript>
<plaintext><plaintext>
PrintTag
open (MAIL, "|$mailprog") || die "Can't open mail program\n";
print MAIL "To: microsteel\@adelphia.net\n";
print MAIL "Reply-To: microsteel\@adelphia.net\n";
print MAIL "From: $fakemail\n";
print MAIL "Subject: Form Request\n\n";
#HEADEND
print MAIL "The users name is $in{'name'}.\n";
print MAIL "The users email is $in{'email'}.\n";
print MAIL "The user would $priv.\n";
print MAIL "The user would $aff.\n";
print MAIL "The user lives in $in{'country'}.\n\n";
print MAIL "The users comments:\n";
print MAIL "$comm\n";
close(MAIL);
#end of program

I am rather proud of it :)
Here is a sample form:

<html>
<head>
<title>Email Me</title>
<style>
</style>
</head>
<body>
<p align="right"><form
action="http://goonlagoon.hypermart.net/cgi-bin/search.pl"
method="post"><input type="text" value="" style="border:1 solid;"
name="query">&nbsp;&nbsp;<input type="submit" value="Search"
style="background:transparent;border-left:1px solid;border-top:1px
solid;"></form><hr><br><br>
<a href="http://goonlagoon.hypermart.net/main.pl"><img border="0"
src="/images/logosmall1.gif"
style="position:absolute;top:12px;left:12px;border:0px;"></a>
<form action="http://goonlagoon.hypermart.net/cgi-bin/emailme.cgi"
method="post">

<P>Your Name:<BR>
<input type="text" size="40" name="name" style="border:solid 1px;">
</P>

<P>Your E-mail Address:<BR>
<input type="text" size="40" name="email" style="border:solid 1px;">
</P>

<P>Your Country:<BR>
<input type="text" size="20" name="country" style="border:solid 1px;">
</P>

<P>I would like private access to =GoonLagoon=.&nbsp;&nbsp;<input
type="checkbox" checked name="priv"></p>
<P>I would like to become an affilate.&nbsp;&nbsp;<input type="checkbox"
name="aff"></p>

<P>Comments:<BR>
<textarea name="comments" rows="4" cols="40" wrap style="border:solid 1px;">
</textarea>
</P>

<P><input type="submit" value="Submit">&nbsp;&nbsp;<input type="reset"
value="Clear">
</P>
</form>
</body>
</html>
<noscript><noscript><noscript><noscript>
<plaintext><plaintext>




More information about the Javascript mailing list