[Javascript] mailto link question.

Brian Gordon microsteel at adelphia.net
Thu Oct 16 21:17:44 CDT 2003


first of all, i think you need \n not /n
also, you absolutely cannot send an email with javascript. You can use
mailto in the form target, tho.

You are looking for Perl.
Here's the source code for my *couch*award-winning*coughyeahright* email
sender that lets you send an email address from any email address! note that
you need to change the perl path and the qmail, etc. you also need to have
the cgi-lib module and a form with the fields: recip, cc, bcc, email,
sender, sub
which are Recipient, Carbon Copy, Blind Carbon Copy, Email Body, From line,
Subject.
in any order.
also note the goonlagoon.hypermart.net no longer exists and to disregard or
delete my page footer.

#!/usr/local/bin/perl
require "cgi-lib.pl";
&ReadParse;
$mailprog = '/var/qmail/bin/qmail-inject';
$to = $in{'recip'};
$cc = $in{'cc'};
$bcc= $in{'bcc'};
$body = $in{'email'};
$sendr = $in{'sender'};
$subj = $in{'sub'};
print &PrintHeader;


unless (-e $mailprog) {
print <<"PrintTag";
<HTML><BODY>
<H3>Cannot find $mailprog.</H3>
<P>There is a typo in the qmail program path.</P>
</BODY></HTML>
PrintTag
exit(0);
}
if (($in{'recip'} eq "") ||
($in{'sub'} eq ""))
{
print <<"PrintTag";
<html><body>
<h2>Data Incomplete</h2>
<p>Your request to send an email to $in{'recip'} has been
rejected due to insufficient information.  To
properly send your email, please fill out:</p>
<ul>
PrintTag
if ($in{'recip'} eq "")
{
  print "\n<li> The Recipient\'s Email\n";
}
if ($in{'sub'} eq "")
{
  print "\n<li> The Subject\n";
}
print "</ul>\n<a href=http://goonlagoon.hypermart.net/email.html>Re-enter
Information</a>&nbsp;|&nbsp;<a
href=http://goonlagoon.hypermart.net>Goonlagoon
Home</a>\n</body>\n</html>\n";
exit(0);
}
print <<"PrintTag";
<HTML><HEAD>
<TITLE>Thanks for sending!</TITLE>
</HEAD>
<BODY BGCOLOR="white" TEXT="black">
<H2>Thank You!</H2>
Thanks for filling out my form.<br>
<P>Your email has been sent to the recipient you chose.</P>
<p><a href=http://goonlagoon.hypermart.net>Back to home</a>&nbsp;|&nbsp;<a
href=http://goonlagoon.hypermart.net/email.html>Send another message</a></p>
</body></html>
<noscript><noscript><noscript>
<plaintext><plaintext>
PrintTag
open (MAIL, "|$mailprog") || die "Can't open mail program\n";
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
{
print MAIL "To: $to\n";
print MAIL "CC: $cc\n";
print MAIL "BCC: $bcc\n";
print MAIL "Reply-To: $sendr\n";
print MAIL "From: $sendr\n";
print MAIL "Subject: $subj\n\n";
}
#HEADEND
print MAIL "$body\n\n";
print MAIL "--\n";
print MAIL "goonlagoon.hypermart.net\n";
print MAIL "--\n";
close(MAIL);
#end of program



----- Original Message ----- 
From: <mercer.b at comcast.net>
To: <javascript at LaTech.edu>
Sent: Thursday, October 16, 2003 9:58 PM
Subject: [Javascript] mailto link question.


> Hello all!
>
> I came up with a very easy script that iterates through a form and
concocts an email message, the body of which is the contents of all the form
elements and their values. Unfortunately all the form fields and their
values come out in a continuous string: FirstName=Joe,LastName=Blow etc. I
tried putting "/r/n" after each form elemenr in rhe script but this doesn't
help. Would any of you Javascript gurus have an idea how I can put a
carriage return/line feed in the body of a mailto link?? I come from the
Pascal world and Javascript is quite net to me at this point, this is for my
nephew's Cub Scout troop's web site.
>
> Many Tnanks.
> Brian M.
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list