If you’ve ever written a website in HTML, you are probably familiar with the MailTo-command, used to automatically start a new email message when the link is clicked. However, you can do so much more with the command. Here are some examples:
- Address message to multiple recipients
- Add entry in the “Subject” field
- Add entry in the “Copy To” or “CC” field
- Add entry in the “Blind Copy To” or “BCC” field
- Add entry in the “Body” field
Now, I’m sure you’re wondering how exactly we get the code to do this. Here’s how (click the link to see the effect):
- Simple MailTo
- <a href=”mailto:recipient@server.tld”>
- MailTo with Multiple Recipients
- <a href=”mailto:recipient@server.tld,recipient2@server.tld”>
- MailTo with Subject
- <a href=”mailto:recipient@server.tld?subject=Comments from website”>
- MailTo with a Copy
- <a href=”mailto:recipient@server.tld?cc=recipient2@server.tld”>
- MailTo with a Blind Copy
- <a href=”mailto:recipient@server.tld?bcc=recipient2@server.tld”>
- MailTo with message already started in Body
- <a href=”mailto:recipient@server.tld?body=I am having trouble finding information on “>
- MailTo with multiline message in Body
- <a href=”mailto:recipient@server.tld?body=The message’s first paragraph.%0A%0aSecond paragraph.%0A%0AThird Paragraph.”>
- NOTE: Use “%0A” for a new line, use “%0A%0A” for a new line preceded by a blank line.
Of course, you can also combine the effect:
- MailTo with Subject, a Recipient, a Copy and a Blind Copy
- <a href=”mailto:recipient@server.tld?subject=MailTo Comments&cc=recipient2@server.tld&bcc=id@internet.node”>
By posting a comment, you consent to our collecting the information you enter. See privacy policy for more information.