[ACCEPTED]-Can I use JavaScript to create a client side email?-email

Accepted answer
Score: 18

What we used in a projet is a popup window 4 that opens a mailto: link, it is the only 3 way we found to compose a mail within the 2 default mail client that works with all 1 mail clients (at least all our clients used).

var addresses = "";//between the speech mark goes the receptient. Seperate addresses with a ;
var body = ""//write the message text between the speech marks or put a variable in the place of the speech marks
var subject = ""//between the speech marks goes the subject of the message
var href = "mailto:" + addresses + "?"
         + "subject=" + subject + "&"
         + "body=" + body;
var wndMail;
wndMail = window.open(href, "_blank", "scrollbars=yes,resizable=yes,width=10,height=10");
Score: 6

You more or less only have two alternatives 1 when sending mail via the browser..

  1. make a page that takes user input, and allows them to send the mail via your web-server. You need some kind of server-side scripting for this.
  2. use a mailto: link to trigger opening of the users registered mail client. This has the obvious pitfalls you mentioned, and is less flexible. It needs less work though.
Score: 4

With javascript alone, it's not possible.
Javascript 11 is not intended to do such things and is 10 severely crippled in the way it can interact 9 with anything other than the webbrowser 8 it lives in, (for good reason!).

Think 7 about it: a spammer writing a website with 6 client side javascript which will automatically 5 mail to thousands of random email addresses. If 4 people should go to that site they would 3 all be participating in a distributed mass 2 mailing scam, with their own computer... no 1 infection or user interaction needed!

Score: 1

You can create a mailto-link and fire it 1 using javascript:

  var mail = "mailto:buddy@mail.com?subject=New Mail&body=Mail text body";  
  var mlink = document.createElement('a');
  mlink.setAttribute('href', mail);

More Related questions