Not receiving form results from MSN Users

Discussion in 'JavaScript' started by dawgmom, Jul 3, 2006.

  1. #1
    had someone write some ASP and Javascript for our nonprofit Web site. It uses CDO to send the form results, and puts the in users email address [as the return address] using [in part]:

    'objCDOSYSMail.From = Request("email")'

    The JS that validates is [in full]:

    <SCRIPT LANGUAGE="JavaScript">
    function emailCheck(fld)
    {
    // first, trim the email text:
    var email = fld.value.replace(/^\s+/,"").replace(/\s+$/,"");

    var re = /^([a-z][\w\-\'\=]+\.)*[a-z][\w\-\'\=]+\@([a-z][\w\-\'\=]+\.)+[a-z]{2,6}$/i
    if ( ! re.test( email ) )
    {
    alert("Please enter a valid email address");
    fld.focus( );
    return false;
    }
    return true;
    }
    function checkPwd(fld)
    {
    var pwd = fld.value.replace(/^\s+/,"").replace(/\s+$/,"");
    if ( pwd == "" )
    {
    alert("You did not type the characters into the security box.");
    fld.focus( );
    return false;
    }
    return true;
    }
    function validate(frm)
    {
    if ( ! emailCheck( frm.email ) ) return false;

    if ( ! checkPwd( frm.pwd ) ) return false;

    // other validation
    return true;
    }
    </SCRIPT>

    And the form field is [in part]:

    <td><form name="newsletter" method="post" action="newsletter.asp" onSubmit="return validate(this);">
    <input type="hidden" name="_FROM_PAGE" value="newsletter.asp">
    <table width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td><table width="100%" cellpadding="0" cellspacing="0">
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td width="585"><div align="left"><span class="style10"> Please provide your email address:</span>&nbsp;
    <input name="email" value="<%=Trim("" & Request("email"))%>" size=40>

    It all works fine except I don't receive any results from MSN or Hotmail users [at least those are the 2 I'm aware of]. I've removed this line:

    var re = /^([a-z][\w\-\'\=]+\.)*[a-z][\w\-\'\=]+\@([a-z][\w\-\'\=]+\.)+[a-z]{2,6}$/i
    if ( ! re.test( email ) )

    And, it works. I also know that I can change the CDO to use myaddress as the 'from' address, but I'd really like to see who the email is from before I open it. Can someone please help by telling me if I can have it validate and put the users email address in and how?
     
    dawgmom, Jul 3, 2006 IP