Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending email via java script

Status
Not open for further replies.

Terpsfan

Programmer
Dec 8, 2000
954
US
Can someone explain to me why this doesn't work? I found this on a java tutorial web site. I believe we are using Outlook/MS Exchange for email. I get no error messages and it says it sends the email, but nothing happens. Thanks

Code:
<html>
<head>
<TITLE>
</TITLE>
</HEAD>
<Body>
<SCRIPT LANGUAGE="JavaScript"><!--
var current = 0;

function sendEmail() {
    if (navigator.appName.indexOf('Netscape') > -1) {
        if (document.controlForm.selectName[current].selected) {
            document.emailForm3.action = 'mailto:' +
                                         document.controlForm.selectName[current].value +
                                         '?subject=' +
                                         document.controlForm.subject.value;
            document.controlForm.to.value = document.controlForm.selectName[current].value;
            current++;
            if (current < item) setTimeout('document.emailForm3.mysubmit.click()',5000);
            else current = 0;
        }
        else {
            current++;
            if (current < item) document.emailForm3.mysubmit.click();
            else current = 0;
        }
    }
}
//--></SCRIPT>

<FORM NAME="controlForm">
<SELECT MULTIPLE NAME="selectName">
<OPTION VALUE="anyone@aol.com">anyone

</SELECT>
<P>To:<BR><INPUT TYPE="text" NAME="to" SIZE=72>
<P>Subject:<BR><INPUT TYPE="text" NAME="subject" SIZE=72>
</FORM>

<SCRIPT LANGUAGE="JavaScript"><!--
var item = document.controlForm.selectName.length;
//--></SCRIPT>

<FORM NAME="emailForm3" ACTION="" METHOD="POST" ENCTYPE="text/plain" onSubmit="sendEmail()">
<P>Contents:<BR><TEXTAREA NAME="content" COLS=72 ROWS=20></TEXTAREA>
<P><INPUT TYPE="submit" NAME="mysubmit" VALUE="Send Email"> <INPUT TYPE="reset" VALUE="Reset">
</FORM>


</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top