<p>In a <code>mailto</code> link, you can enter default values for most fields using URL parameters. Here's an example:</p>
<pre><code>mailto:me@example.com&amp;subject=Foo&amp;body=Bar
</code></pre>
<p>This link will open the visitor's e-mail program and set the subject and body fields to <code>Foo</code> and <code>Bar</code>, respectively. You can enter those parameters directly in the Link field when the E-Mail type is selected. Spaces are replaced by <code>+</code> signs after saving, as some characters need to be encoded/escaped in a URL parameter.</p>
<p>If you don't like the user experience of this solution, you can also create additional plain text fields next to the Link field for authors to enter a default subject and body without having to remember any syntax. Then assemble the link in your template from those fields.</p>
<p>See <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Creating_hyperlinks#email_links" rel="nofollow noreferrer">MDN for more details on E-Mail links</a>.</p>

CC BY-SA 4.0
2024-11-02T19:32:04.040Z
2024-11-02T19:32:04.040Z
MoritzLost
<p>The Link Field in Craft 5 is a good improvement, but I can't find a way to populate the link with a pre-filled Subject and Body to the email.</p>

<field><emails><link>
Link Field Email with Subject and Body
# Link Field Email with Subject and Body

(Asked by: username_0 on 2024-11-01)

The Link Field in Craft 5 is a good improvement, but I can't find a way to populate the link with a pre-filled Subject and Body to the email.

**Tags:** field, emails, link

---

## 1 answers

### Answer by username_1 on 2024-11-02. Score: 1

In a mailto link, you can enter default values for most fields using URL parameters. Here's an example:
mailto:me@example.com&subject=Foo&body=Bar

This link will open the visitor's e-mail program and set the subject and body fields to Foo and Bar, respectively. You can enter those parameters directly in the Link field when the E-Mail type is selected. Spaces are replaced by + signs after saving, as some characters need to be encoded/escaped in a URL parameter.
If you don't like the user experience of this solution, you can also create additional plain text fields next to the Link field for authors to enter a default subject and body without having to remember any syntax. Then assemble the link in your template from those fields.
See MDN for more details on E-Mail links.


---

