Results 1 to 2 of 2

Thread: how do i use javascript to e-mail something

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Posts
    117

    Exclamation

    ok i'm relatively new to javascript, but i'm pretty good. one thing i've been trying to do with javascript is to send an e-mail message using javascript's Sendmail() object. However, nothing ever happens when i use it. if anyone knows how to do this, please help me.

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    First off, This is core javascript. It is only supported server side and to the best of my knowledge is only supported in a Netscape's Server-Side Addition. Here is a simple example of what the code looks like:

    Code:
    <server>
    //See what's happening
    if(request.method == "POST"){
    
    //create a new mail object
    var tMail = new SendMail();
    
    //assign some values
    tMail.To = request.To;
    tMail.From = request.From;
    tMail.Subject = request.Subject;
    tMail.Body = request.Message;
    tMail.Smtpserver = "mail.yourserver.com";
    
    //Try to send
    if(!myMail.send()){
       alert(tMail.errorCode() + ":  " + tMail.errorMessage());
    }
    else{
       alert("Mail Sent.");
    }
    }
    </server>
    <form name="MailForm" Method=POST>
    To:  <input type="text" name="To"><br>
    From:  <input type="text" name="From"><br>
    Subject:  <input type="text" name="Subject"><br>
    Message:  <TextArea name="Message" cols=50 rows=15><br>
    <input type="submit" value="Send"><input type="reset" value="Clear">
    </form>
    Hope this helps.

    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

Posting Permissions

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



Click Here to Expand Forum to Full Width