0

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?

IT pedia
  • 15
  • 1
  • 4
  • Below is the old post what you want: https://stackoverflow.com/questions/6988355/open-gmail-on-mailto-action – Terry Wei Jun 05 '18 at 01:28
  • Possible duplicate of [Open Gmail on mailto: action](https://stackoverflow.com/questions/6988355/open-gmail-on-mailto-action) – Mihai Chelaru Jun 05 '18 at 01:31

2 Answers2

0

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>
Terry Wei
  • 1,521
  • 8
  • 16
0

Use this and style it according to you

<a href="mailto:example@email.com">Link text</a>