Skip to content

How to add a mail link using mail to

macourtney edited this page Sep 13, 2010 · 2 revisions

Added for version: 0.4

If you would like to add a mailto link to your page, you can use the mail-to function.

Currently, the mail-to function does not try to hide the e-mail address you give it. Use this function at your own risk.

To add a mail to link to “[email protected]” use:

(mail-to { :address "[email protected]" })

If you want to display “Mail to Foo” instead of the entire e-mail address as the link text use:

(mail-to { :address "[email protected]", :name "Mail to Foo" })

You can add other html options by passing an html-options key. To set the class to “mail-to-link” use:

(mail-to { :address "[email protected]", :html-options { :class "mail-to-link" } })

If you don’t want to use :name but would like to change the text of to be more readable, you can use replace-at and replace-dot. To change the at symbol to " at ", and all periods to " dot " you can use:

(mail-to { :address "[email protected]", :replace-at " at ", :replace-dot " dot " })

The final text of the above link will look like “foo at example dot com”.

To preset the subject to “Help!” of the e-mail use:

(mail-to { :address "[email protected]", :subject "Help!" })

To preset the body of the e-mail to “I need help!” use:

(mail-to { :address "[email protected]", :body "I need help!" })

If you want to send a copy to another e-mail address use:

(mail-to { :address "[email protected]", :cc "[email protected]" })

If you want to send a blind carbon copy to another e-mail address use:

(mail-to { :address "[email protected]", :bcc "[email protected]" })
Clone this wiki locally