Email link code that writes subject and more

Using “mailto:” for the basic email link

An email link is simply one that upon clicking it will open the user’s email client of choice and add the email address to a new blank email, simple! It uses the code: “mailto:” before the email address, and it looks like this:

<a href=”mailto:iopan@hotmail.com“>Email iopan</a>

So the outcome would be: Email iopan

(Click this link to see how your email client will open)

 

Email link writes the Subject

Email link writes the Subject

Using “?subject=” to add a subject to the email link

Have you ever wondered how an email link – once clicked on – can open your email client and write the SUBJECT and some BODY text automatically? It’s simply a matter of adding some extra code to the link, after the email address. So by adding the code: “?subject=” after the email address, the subject will be written also. Here’s what it looks like:

<a href=”mailto:iopan@hotmail.com?subject=iopan%20blog%20entry“>Email iopan</a>

The outcome is now: Email iopan

(Click this link to see how the subject will be written)

Notice, that instead of a space, we have to add the code %20 – this is because the a href attribute will not accept empty spaces. There are other characters that need to be written in code, and you can see them in the table below.

Character Name Character Symbol CODE
A single carriage return (line break) %0D
Full stop . %2E
Comma , %2C
Exclamation mark ! %21
Question mark ? %3F
Speech marks %22
Single inverted comma %27
Ampersand & %26
Commercial at @ %40
Opening parenthesis ( %28
Closing parenthesis ) %29
Colon : %3A
Semicolon ; %3B
Hyphen %2D

 

Email link writes the Subject and the Body

Email link writes the Subject and the Body

Using “&body=” to add body text to the email link

As you may have guessed, adding the body text is now a straight-forward matter of adding the code: “&body=” after the email subject, and writing the copy, remembering to use “%20” for your spaces, and other special character codes.

So – for example – I would like my body text to read:

This is a great blog post! Would you please subscribe me to your blog?

In the HTML code, this would be written as:

<a href=”mailto:iopan@hotmail.com?subject=iopan%20blog%20entry&body=This%20is%20a%20great%20blog%20post%21%20Would%20you%20please%20subscribe%20me%20to%20your%20blog%3F“>Email iopan</a>

Outwardly, the outcome appears the same: Email iopan

(Click this link to see how the body text will also be written)

 

Other parts of the email link that you can alter

You can also set an email’s CC and BCC recipients*, by using “&cc=” and “&bcc=” respectively.

*These abbreviations stand for “Carbon Copy” and “Blind Carbon Copy” – If you are sending a straightforward copy then cc will suffice, BUT, if you are sending a copy and you don’t wish the other recipients to see that you sent it to this contact, use bcc.

Leave a Reply