Search code examples
javascripthtmlemailhrefmailto

What is best practice for coding an email contact button on your site


I don't want to use mailto: because I personally find it annoying when it opens outlook which I never use.

<a href="mailto:[email protected]">Email Homer</a> 

Should I have the button open a new page with just the email address in it? Is there a way to have it automatically copy?


Solution

  • you have two options basically. Use mailto which will use the user's defined email application (could be outlook, yahoo, gmail, whatever). This is the fastest to program since you don't do a thing, just add the link and be done.
    The other is to create your own email page. The cons to this is that it's more work from you. The pros is that you can specify more fields that give you more info (for example, order #, phone, etc). This would use your email server though, not the client's, so make sure the client adds his email address in the form as mandatory (and maybe verification too)