IT pedia
IT pedia

Reputation: 15

html button that opens gmail compose?

I want a contact button on my website in which when the user clicks the Gmail compose mail open in Gmail site with an email address. anyone have any idea how to achieve this?

Upvotes: 0

Views: 3935

Answers (2)

Inzamam Ahmad
Inzamam Ahmad

Reputation: 11

Use this and style it according to you

<a href="mailto:[email protected]">Link text</a>

Upvotes: 0

Terry Wei
Terry Wei

Reputation: 1531

I did an example with the solution of Open Gmail on mailto: action

$('#go').click(function(event){
var email =  $('#email').val();
if(email)
window.location.href = 'https://mail.google.com/mail/?view=cm&fs=1&to='+email;
else
alert('please enter your email');
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span>Please Enter Your Email And Go</span>
<br />
<input id="email" />

<button id="go">Go!</button>

Upvotes: 0

Related Questions