Author Topic: I need your help!  (Read 6514 times)

encargues_miguelerhlich

  • User
  • *
  • Posts: 6
    • http://bsit.bravehost.com
I need your help!
« on: November 30, 2005, 11:03:30 PM »
I would like to ask if what is the javascript of a form which is directed to the email address that you will be submitting. I mean it is a form which has a name,  email-address of the sender and cthe text area and when he/she is going to click the submit button the email will directly go to the websites own email.. Thanks a lot.
Miguel ErhlichD. Encargues

louiecerv

  • Professor
  • User
  • *
  • Posts: 85
Analyze. Design. Develop. Debug. Deploy. Maintain.

encargues_miguelerhlich

  • User
  • *
  • Posts: 6
    • http://bsit.bravehost.com
thanks a lot!
« Reply #2 on: December 01, 2005, 05:18:27 AM »
Sir, I've allreay visited the site and it seems not complete.. Sir, I hope you can give me other site for my prob. Thanks..
Miguel ErhlichD. Encargues

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
I need your help!
« Reply #3 on: December 01, 2005, 09:40:11 AM »
When I first went to reply, I was thinking that you couldn't send an e-mail through JavaScript.  Directly, you can't -- but then I realize that in mailto: links you can add subject and text into it.  When you click it, your mail client will open with a mail.  So it would not be sent directly from the site (this will never be possible with pure JavaScript), but you probably would be able to create a JavaScript that would create the link that would open up the mail client with all info filled out such that all you would need to do is press send.  I will try it briefly here and report back if it works.
Gillius
Gillius's Programming http://www.gillius.org/

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
I need your help!
« Reply #4 on: December 01, 2005, 09:48:22 AM »
OK here is the best one can do, as far as I know.  There is no JavaScript here, but it shows what you are able to do:

Code: [Select]
<html>
  <head>
    <title>E-mail Test</title>
  </head>
  <body>
    <a href="mailto:test@test.org?subject=Whatever&body=test">Send Mail</a>
  </body>
</html>


The best you can possibly do from JS since it is client side is create and activate a link as above.  You could possibly populate the link from form fields, of course.  Clicking on that link will open an e-mail window to test@test.org with the subject Whatever and the body saying test.  But you can't change the "from" address, and and e-mail client and account outside the site will be required.  I suppose if you got to this point there is no reason to do this through JS anyway since you could just have the user type the subject and body into the e-mail program window themselves rather than using your form.

In order to actually send an e-mail from the site, you will need a server-side technology such as CGI, PHP, JSP, etc.  I know there do exist CGI mail forms that are easily downloaded but it requires a server where you can run CGI scripts.
Gillius
Gillius's Programming http://www.gillius.org/

encargues_miguelerhlich

  • User
  • *
  • Posts: 6
    • http://bsit.bravehost.com
Thanks1
« Reply #5 on: December 01, 2005, 09:28:17 PM »
Thanks a lot for the code you have gave to me..
God Bless :D
Miguel ErhlichD. Encargues