Send Email using Link Tag!


Having a link that allows visitors to send email from your website can be a great addition to your site, making it easy for your visitors to send questions or comments.

There is a special link for this action.

Email links are done much the same as links to other pages, using the
<a href> tag.

An email link would require the following code:

<a href=”mailto:RecipientEmailAddress”>Email Me</a>

This will result in the visitor’s email program opening a new email with Email address already in the To: field using Exchange Server (Outlook).

If you wish to have a specific subject in the email, you can add it to the html code using subject= setting [similar adding data in url(QueryString)]:

<a href=”mailto:email@example.com?subject=Sending %20Using %20Html %20Link”>
Send Email</a>

// %20 is HTML encode for a Blank space

Suppose you want an email link for your visitors containing specific text in the body of their message, simply add &body=:

<a href=”mailto:email@example.com? subject=Sending %20Using %20Html %20Link&body=Please send me a copy of your new initiative!”>Send Email</a>

Important:

According to RFC 2368:

The special hname “body” indicates that the associated hvalue is the body of the message. The “body” hname should contain the content for the first text/plain body part of the message. The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as “subscribe” messages for mailing lists), not general MIME bodies.

In short, trying stuff like embedding an image using <img /> tag or using HTML bold tag as following, inside body setting,  simply won’t work!

href=’mailto:me@me.com?subject=Me&body=<b>ME</b>

🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s