Bootstrap Button to Open Email

So I want to enable a button to open the default email sender on the user's computer (eg Outlook) so they can send us a direct email.

How can I do this with bootstrap buttons and what is the best way to keep bots away.

Thanks

Answers


Just use a mailto link with the correct css style:

<a href="mailto:some@email.com" target="_blank" class="btn btn-primary">Email Us</a>

I was thinking to hide the mailto in javascript. Like below. I think the mail has to be obfuscated in the javascript code as well.

Read more about How to spamproof a mailto link?

Not obfuscated example

$(document).ready(function() {
  $('#mailbutton').click(function(event) {
    window.location = "mailto:example@example.com";
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<a href="#" id="mailbutton" class="btn btn-primary">Send us a mail!</a>

Need Your Help

Is it possible to use static variable in subclass from parent class using subclass property, in actionscript 3?

actionscript-3 inheritance static-members

In the code below, could you tell me why _myVar is null while g is not, when b.method() is called?

Recommended ways to split some functionality into functions, modules and packages?

python module package

There comes a point where, in a relatively large sized project, one need to think about splitting the functionality into various functions, and then various modules, and then various packages. Some...