Using Hyperlinks in Twixl InDesign articles, you can launch the reader's mail client and create a new mail message. This article explains how to use the mailto:
syntax (so you can prefill some fields for your reader) and tackles some difficulties for Android devices.
WARNING:
It appears iOS 14.6 introduced a new behaviour where support for rich content in mailto URLs has been removed, because of potential security issues. Please take this into account when trying to use mailto hyperlinks in your Twixl app.
TIP:
For more general info about using Hyperlinks in InDesign, check this article: Hyperlinks
1. General Example
1.1. What?
Let's say you want to achieve the following result: A clickable hyperlink that will prepare a new email for your reader with a pre-defined addressee, subject and body.
Field | Value |
---|---|
To: | to@email.com |
CC: | cc@email.com |
BCC: | bcc@email.com |
Subject: | This is the Subject. |
Body: | This is the Body. |
1.2. Syntax
The syntax for this example is as follows:
mailto:to@email.com?cc=cc@email.com&bcc=bcc@email.com&subject=This%20is%20my%20Subject.&body=This%20is%20my%20Body.
Syntax | Description |
---|---|
mailto:to@email.com |
This is the startpoint, it opens the reader's mail-client with a new empty mail and the To: Field prefilled with the address to@email.com |
?cc=cc@email.com |
This syntax tells that you want to add an option to this url. In this case you want the CC: Field prefilled with the address cc@email.com . Extra options after the first option needs to be added with & as a prefix. The first option after mailto always needs the prefix ? . The following options can also be added: |
&bcc=bcc@email.com |
Option to prefill the BCC: Field. |
&subject=This%20is%%20my%20Subject. |
Option to prefill the Subject: Field. Don’t forget to replace each space by %20 . |
&body=This%20is%20my%20Body. |
Option to prefill the Body: Field. Don’t forget to replace each space by %20 . |
2. Example with a url in the predefined body.
Adding a url to the body can be tricky. If you do this with the standard syntax, it will not work on Android devices.
2.1. What?
Field | Value |
---|---|
To: | to@email.com |
CC: | |
BCC: | |
Subject: | A Body with a url. |
Body: | https://www.twixlmedia.com |
2.2. Syntax
The correct syntax for this example is as follows:
mailto:to@email.com?subject=A%20Body%20with%20a%20url.&body=https%3A%2F%2Fwww.twixlmedia.com
So, the tricky part is the url. You can't use a standard url like https://www.twixlmedia.com
. You will need to encode that url first. You can encode a url by using one of these free online tools:
- https://meyerweb.com/eric/tools/dencoder/
- https://www.urlencoder.org
- http://www.url-encode-decode.com
The result for https://www.twixlmedia.com
will be https%3A%2F%2Fwww.twixlmedia.com
. It's this encoded url that you need to embed in the syntax of your mailto:
url.
REMEMBER:
Always test your setup before you publish! More info about Preview on device can be found here.