简体   繁体   中英

Simple way to send e-mail using javascript

I wanted to know how to send e-mail using javascript. I dont want to use long functions with tag n all other stuff. Interested in only one/two liner statement which will allow me to send mail.

I have used something like that earlier :

function sendmail(_frm)
{
var eml="you@youraddress.com";
var bod="&body="+_frm.selOne.value+" ¦¦ "+_frm.txtOne.value;
var subj="?subject=Whatever you want";
location.href="mailto:"+eml+subj+bod;
}

At Form tag
<form action="mailto:you@youraddress.com" 
enctype="text/plain"
method="POST" onsubmit="sendmail(this);return false;">

I dont want to use above approach to send mail...

Please provide me your suggestion so that i can send mail very easily by using javascript , like below. eg

function sendmail () {
location.href="mailto:<other stuff>"
}

Is anyone has any idea about this, please share their ideas here.

Thanks a lot....

As far as I know there is no other way to send an e-mail from client side with javascript. You can write some server side code or you can find some service to send e-mail. Unfortunaltely I dont know any web application that gives that kind of service. But, I was writing a web application that have limited e-mail functionality added. It is not finished yet (but still usable).Address is http://postdatabase.appspot.com Like I said it is not finished yet, that's why I suggest you to find a completed product. if you decide to use it please contact me from the site, so I can be more carruful to make changes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM