How to created "Email Me" links
By: Jool
Learn how to use mailto: links
I’m sure you’ve seen them, people who have links “Email me”, which when clicked automatically bring up your favorite email application so you can type an email to their address without having to copy and paste their address or anything too complex (not that copy/pasting is complex haha). Anyway, there is a simple way we can achieve this effect with html, that is recognized by almost all browsers. It goes like this.
<a href=”mailto:youraddress@example.com”>SEND ME AN EMAIL!</a>
So, when clicked that will open up whichever email client the user is using and whatever email you want will already be there ready to go. This is too simple, you claim. Of course we can maximize the usage of this by specifying even more then just the address we want to send to. We can specify multiple addresses, a subject, CC and BCC fields and even the message that we want sent to the address.
<a href=”mailto:youraddress@example.com,yoursecondaddress@example.com”>SEND ME AN EMAIL!</a>
This will send to the addresses specified, separate by a comma. Unlimited addresses are supported.
<a href=”mailto:youraddress@example.com?&subject=I sent this email by clicking on your link”>SEND ME AN EMAIL!</a>
This one has the subject specified.
<a href=”mailto:youraddress@example.com?&bcc=ccaddress@example.com”>SEND ME AN EMAIL!</a>
Here the copy feature is used.
<a href=”mailto:youraddress@example.com?&bcc=bccaddress@example.com”>SEND ME AN EMAIL!</a>
Blind copy is also supported.
<a href=”mailto:youraddress@example.com?&body=This is what appears in the message area”>SEND ME AN EMAIL!</a>
We can even specify the body of the message, assuming the user doesn’t edit it themselves of course.
There are many possibilities, many combinations. Any combination of the strings above works, for example if I wanted to email to 2 people with the subject “Hey guys sup”, it would look like this:
<a href=”mailto:person1@example.com,person2@example.com?&subject=Hey guys sup”>Click here to ask us what is up!</a>
So, I’m sure you can find a use for this, there are tons of them. You just have to be weary, spam bots which crawl the web looking for emails to add to their spam lists are often times advanced enough to pull your email from your mailto: hyperlinks and add it to their lists, so make sure if you use these that you are ok with maybe getting a few more spam messages then usual.
|