Helpful Information
 
 
Category: Perl/ CGI
Email

The following is a test page that I'm trying to get to work - figure if I can get this to work, then I can apply it to the real stuff. This may be copied, saved, and run as is:

<html>
<head>
<title>Email Test</title>

<script language="javascript" type="text/javascript">

function fnSubmit(){
var email = "mailto:";
email += frmEmail.RecipientAddress.value;
frmEmail.action = email;
return true;
}

</script>
</head>
<body bgcolor="#FFFFFF">

<form onSubmit="return fnSubmit()" action="" method="post" ENCTYPE="text/plain" name="frmEmail">

<input name="RecipientAddress" size=50 type="text">
<b>To: (Enter E-Mail Address)</b><br>
<p>
<b>Write a message to recipient:</b><br>
<p>
<textarea name="NoteToRecipient" rows=10 cols=50></textarea><p>


<input type=submit value="SEND">
<input type=reset value="CLEAR">


</form>

</body>
</html>

This is the resulting email with subject line "Form posted from Microsoft Internet Explorer":

[email protected]
NoteToRecipient=This is a test.

If I change the ENCTYPE to "text/html", I get the same results. What I want is the actual page to be emailed, not just the values from the form, and it would be nice to change the subject line. Problem is, I'm not on a Unix server; I'm on a Windows server, and there's just not a lot of samples for this.

-Amy

Oh, and I use Perl for server-side scripting - which is why I'm in this forum.

Even if you do 'use Perl for server-side scripting' that won't help you here because you haven't posted a single bit of PERL/CGI anywhere in that code. You have a JavaScript that is running on submission of the form that emails a message (which the user types in) to an email address (which the user also types in).

If you are really trying to do a server side form processing for an email delivery, then we can help you out (but this code won't help you out). However, if this really does have nothing to do with PERL and you just want to modify the existing script, then I'll move this to the JavaScript forum as that would be the most apropriate section...

Either way, can you clear up exactly what you are trying to do so we can better help you/point you in the right direction?

okay, I really don't know where I'm supposed to post this question because I don't know where the answer lies (in javascript, perl, whatever). My original file is in perl. You can make any html file a perl file by saving it as .pl and adding a few lines at the top and bottom. That's not the point. I assumed I would need to post this in the Perl/CGI forum because my original file is in perl; if it needs to be in the javascript forum, then sobeit. All I need is to be able to email the page I'm looking at (for it to appear exactly as you see it). Sorry for the confusion. Here is the perl file:

#!C:\Perl\bin\perl.exe -wT
use CGI ':standard';

my $strCN = param(hdnCNum);
my $strFN = param(hdnFName);
my $strLN = param(hdnLName);

print header;

print << "HTML code0";

<html>
<head>
<title>Email Test</title>

<script language="javascript" type="text/javascript">

function fnBack(){
window.history.back();
}

function fnSubmit(){
if (frmEmail.RecipientAddress.options[frmEmail.RecipientAddress.selectedIndex].value == "") {
window.alert("You must select an email address before sending");
frmEmail.RecipientAddress.focus();
frmEmail.RecipientAddress.select();
return false;
}
else {
var email = "mailto:";
email += frmEmail.RecipientAddress.options[frmEmail.RecipientAddress.selectedIndex].value;
frmEmail.action = email;
return true;
}
}

</script>
</head>
<body bgcolor="#FFFFFF">

<form onSubmit="return fnSubmit()" action="" method=post ENCTYPE="text/plain" name=frmEmail>

<select name="RecipientAddress" size=1>
<option value="">Select One
<option value="amy2go\@attbi.com">Amy
</select>

<b>To: (Enter E-Mail Address)</b><br>
<p>
<b>Write a message to recipient:</b><br>
<textarea name="NoteToRecipient" rows=10 cols=50></textarea><p>

<input type=button onclick="fnBack()" value="Back">
<input type=reset value="Clear">
<input type=submit value="Send">

<input type=hidden name=CallNumber value="$strCN">
<input type=hidden name=FirstName value="$strFN">
<input type=hidden name=LastName value="$strLN">

</form>

HTML code0

print end_html;

In this case the email would look something like this:

[email protected]
NoteToRecipient=This is a test.
CallNumber=17598
FirstName=Amy
LastName=










privacy (GDPR)