Tips and workarounds
- Solution to list-style-image problems in IE
- Creating boxes with rounded corners
- Email links with message values
Adding an email link with subject, message body and multiple recipients into an email
It's easy enough to add an email link into an email using mailto:, but you can also add a subject, body and multiple recipients. A good example is when you need to have an email link such as 'Unsubscribe me' on a marketing email. You should of course avoid putting email addresses into web pages because these can be collected and used by spammers, so avoid using this technique or any mailto: link in a web page.
In my 'Unsubscribe me' link, I want the subject text to say 'Unsubscribe me.' and the message body to say 'Dear Company Name, Would you please remove me from your mailing list. Thank you.' Not only that, but I want it to be sent to multiple recipients. Have a look at the email that is generated when the user clicks on the link.
First create a standard html email link like this
<a href='mailto:unsubscribe@companyname.com'>Unsubscribe me</a>
If you want to send the email To multiple recipients, simply comma seperate each email address like this
<a href='mailto:unsubscribe1@companyname.com, unsubscribe2@companyname.com'> Unsubscribe me </a>
Next let's add the subject text. This is done by adding the Subject parameter using the ? operator which tells the email clent that there are parameters to follow. Like this
<a href='mailto:unsubscribe@companyname.com?Subject=Unsubscribe me'> Unsubscribe me </a>
Now let's add a message body text. This is seperated from the previous parameter using the & operator
<a href='mailto:unsubscribe@companyname.com
?Subject=Unsubscribe me.
&Body=Dear Company Name, Would you please remove me from
your mailing list. Thank you.'>
Unsubscribe me
</a>
Note that I have laid out these examples for easier reading, but in reality they should be completely unformatted.
You may also add further email recipients to this message by adding any of the To, Cc and Bcc parameters
&To=thisperson@companyname.com
&Cc=another@companyname.com
&Bcc=yetmore@companyname.com
Lastly, there are several characters we are not actually allowed to use in this email link. Email links don't allow spaces between words. A bit of a nuisance, but we get round this by replacing each space with the code %20. It looks a little odd, but your computer has no eye for elegance. The new line /carriage return character is also not allowed so replace these with %0D%0A.
The email link we have created is actually written using HTML so the usual HTML rule applies that certain characters will cause unexpected outcomes. These must be replaced with html special character codes. These dissallowed characters include the & operator, which needs to be replaced with the special character code &. If you want to add quote marks into your text then these also need to be replaced with the relevant special character code.
Here is what our complete piece of html looks like once we have replaced all the disallowed characters
<a href='mailto:unsubscribe1@companyname.com,
unsubscribe2@companyname.com
?Subject=Unsubscribe%20me.
&Body=Dear%20Company%20Name,%0D%0AWould%20you%20please%20remove%20me%20from%20your%20
mailing%20list.%0D%0A%0D%0AThank%20you.
&Bcc=thatperson@companyname.com
&Bcc=theotherperson@companyname.com'>
Unsubscribe me</a>
Be aware that many email clients only support html prior to HTML 4.0. This means at the time of writing CSS may not be an option.
Here is the new mail message that results from the user clicking our mailto link from inside an email