Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Email

  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Dallas
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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":

    RecipientAddress=amy2go@attbi.com
    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
    Some days you are the bug; some days you are the windshield.

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    Dallas
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh, and I use Perl for server-side scripting - which is why I'm in this forum.
    Some days you are the bug; some days you are the windshield.

  • #3
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Dallas
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    RecipientAddress=amy2go@attbi.com
    NoteToRecipient=This is a test.
    CallNumber=17598
    FirstName=Amy
    LastName=
    Some days you are the bug; some days you are the windshield.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •