Click here to Skip to main content
15,886,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys!

How to send email using javascript or jquery in html from gamil account.
Please help me.

Thank you in advance!
Posted
Updated 13-Jun-16 16:45pm

call following function on onclientclick of button

JavaScript
function sendMail()
{
  var link = "mailto:me@example.com"+
             "?cc=CCaddress@example.com"+
             "&subject=" + escape("This is subject")+
             "&body=" + escape("This is body");
  window.location.href = link;
}


escape function:
This function makes a string portable, so it can be transmitted across any network to any computer that supports ASCII characters.
 
Share this answer
 
v2
Comments
Sumit Kumar Singh India 21-Dec-11 2:41am    
Dear koolprasad,

This is working fine!! Thanks a lot.
but right now i am facing another problem
i want to get value for body from html text control and i tried following code:

//var name=document.getElementbyId("txtName");
var txtN = document.getElementById ('[txtName]');
alert(txtN.value);
but it's does not working, could you help me please.
Hi Sumit Kumar Singh,

You are assigning a value from a id [called txtName] to a variable, txtN. So you don't need to use .value property. Just use
alert(txtN) ;

It worked in my case. Hope it works for you too.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900