Mailto and SMS links: the syntax, with examples
How to write mailto links with a subject, body, cc and line breaks, and sms links with a pre-filled message, so they work in Gmail, Outlook, iPhone and Android.
The Liite team4 min read
A "Request a quote" button that opens an email with the subject already filled in. A "Text us to book" link that opens Messages with your number and a first line ready to send. Both are plain links with a special start: mailto: and sms:.
They're simple, but the details trip people up: line breaks that turn into odd characters, a subject that stops at the first &, a body that doesn't appear on one phone. Here's the syntax that works.
Mailto links
The simplest mailto link is just an address:
mailto:hello@example.comAdd more by putting a ? after the address and joining the extras with &:
mailto:hello@example.com?subject=Quote%20request&body=Hi%2C%20I'd%20like%20a%20quote%20forThe parts you can use:
- subject: the subject line.
- body: the text of the email.
- cc and bcc: extra recipients.
- More than one recipient: separate addresses with commas, like
mailto:sam@example.com,priya@example.com.
In HTML it's an ordinary link:
<a href="mailto:hello@example.com?subject=Quote%20request">Request a quote</a>Encode everything after the address
Everything after the ? has to be URL-encoded, or mail apps get confused. The ones that cause trouble:
- Spaces become
%20. Don't use+: some mail apps show it as a plus sign. - Line breaks become
%0D%0A. Gmail, Outlook and Apple Mail all read that as a new line. - & in your text becomes
%26, or the subject or body stops there. - ? becomes
%3F, and # becomes%23. - Commas can stay as they are in most apps, but
%2Cis safest.
So a two-line body that says "Hi," and then "I'd like to book." becomes:
body=Hi%2C%0D%0AI'd%20like%20to%20book.Typing this by hand is fiddly. Our mailto link generator does the encoding, checks the addresses, and gives you the link, an HTML snippet and a QR code.
Mailto pitfalls
- No default mail app. On a shared or work computer, clicking a mailto link may do nothing, or open an app nobody uses. Show the address as text next to the link so people can copy it.
- Long bodies get cut off. Some browsers and mail apps cut links at around 2,000 characters. Keep templates short.
- Spam. An email address in a public page can be read by bots that collect addresses. A contact form avoids that.
SMS links
An sms link opens the Messages app with your number filled in:
sms:+447700900123Add a message with ?body=:
sms:+447700900123?body=Hi%2C%20I'd%20like%20to%20book%20a%20tableThe same encoding rules apply: %20 for spaces, %0D%0A for line breaks. And in HTML:
<a href="sms:+447700900123?body=Hi%2C%20I'd%20like%20to%20book">Text us</a>Our SMS link generator builds the link, the HTML and a QR code for print.
SMS on iPhone, Android and desktop
- Use
?body=. Older guides say iPhones need&body=instead. Current iPhones and Android phones both read?body=. - Include the country code, like
+44or+91, so the link works for people texting from abroad. - Stick to one number. Links to several numbers at once aren't handled the same way on iPhone and Android.
- Desktop is hit and miss. On a laptop, an sms link may do nothing or open a phone-link app. If many visitors use computers, show the number as text too.
Nothing is sent automatically. Both kinds of link only fill in the message; the person still presses send.
QR codes for both
A QR code can carry either kind of link, which is handy on posters, flyers and shop windows. Scanning opens a new email or text, ready to send. The SMS generator uses the SMSTO: format that most phone cameras understand. Print the code large enough to scan from where people stand, and test it with a couple of phones first.
If your customers prefer WhatsApp to texting, the same idea works with a wa.me link. Our WhatsApp link generator makes one with a pre-filled message.
Every way to reach you, on one page
Most people have a favourite way to get in touch, and it's rarely the same one. A Liite page at liite.co/yourname can put an email button, a call button and your WhatsApp link side by side, with a count of how many people tap each one.
If you'd rather not show your email address at all, add a Form block instead. Messages arrive in your inbox, and bots never see your address.
Build a link with the mailto link generator or the SMS link generator, or make your free page and give people every way to reach you.