Every bloggers and site owners put a mailto button on their site so as to help their visitors to contact them directly via email. The common syntax to put a mailto hyper link is mailto:YOUR_EMAIL. When somebody clicks on such link, the default email client will open in the user's PC with the address pointing to the mailto email ID. But there are a lot of issues you may face putting such links on your site. Here are some of them I have listed out.
Problems with emailto links
- It opens the default desktop email client to send email, but now-a-days people rarely install such clients due to rise in web based emails.
- In many cases, although the email client is installed but they are not configured.
- In both of above cases browser creates an annoying situation for the users. Either it will show an error message saying no email client has been installed or it will start showing configuration pop up to configure your email client if it is not confugured previously.
How to link to Gmail compose window directly
You can directly link a mailto button to Gmail compose window in full screen mode. Following is the URL to link. The only requirement for this is, user must be login to view the compose window. If user is not login then she/he will be redirected to login page.
To put such a link in your site just add following code.
The only concern of this method is, if user is not currently login she/he will be redirected to login page first. Except this, there is no other issue. It looks awesome on your site.
You can also add some extra flavors to this technique. You can link to Gmail compose window only if the user is currently login in Google, otherwise display the traditional mailto. Here is how you do it.
Linking to Gmail compose window only if user is currently login
Paste the following code in your site to open Gmail compose window based upon user's login. To verify the functionality, open following link in your browser with and without login. You can understand the difference.
Hope you liked the trick. Let me know your views in the comments.