Mail-To

Mail-To Link #

When you click on a Mail-To link, your default email app opens, and there will be a draft of a new email. You can set email address, subject, body, cc (email for getting a copy), and bcc (email for getting hidden copy).

Read more about this feature in RFC 6068.

Minimal example #

For minimum usage, you have to specify at least an email address. So you get a link to email to this address: isqua@example.org

Code:

{{< mailto email="isqua@example.org" />}}

Full example #

You can specify additional parameters like subject, body, cc, and bcc, and also change the link text. Like this: email me

Code:

If you have any questions, {{< mailto
    email="isqua@example.org"
    subject="Hugo Shortcodes"
    body="Hi, isqua"
    cc="alice@example.org,bob@example.org"
    bcc="bigboss@example.org"
    >}}email me{{</ mailto >}}

Parameters #

ParameterDefaultDescription
emailThe address to send email to
subjectThe subject of the email. Any text but not too long
bodyThe body of the email. Any text but not too long
ccThe copy recipient’s email. If you need to send copies for multiple emails, add them separated by a comma: alice@example.org,bob@example.org
bccThe hidden copy recipient’s email. The same rules as for cc
inner textemail field valueThe text to show

Installation #

Don’t forget to install shortcode before usage.

Install all shortcodes at once

If you need dozens of them, it’s better to attach this repository as a theme to your website.

First, add the theme as a git submodule:

git submodule add -b theme https://github.com/isqua/hugo-shortcodes.git themes/hugo-shortcodes

Then add the theme to your config.toml. Most likely you have the following line in your config:

theme = 'ananke'

There may be another theme in place of “ananke”.

Then surround the theme with square brackets, and appends 'hugo-shortcodes' with a comma at the end:

theme = [ 'ananke', 'hugo-shortcodes' ]

That’s it! If your hugo server is running, it is better to restart it to avoid unexpected behavior.

Now you can use all the shortcodes on any content page of your site.


Install only current shortcode

If you need only one shortcode or installing a theme is too complicated, you may get it easier.

That’s it! If your hugo server is running, it is better to restart it to avoid unexpected behavior.

Now you can use the shortcode on any content page of your site.