namsral / multipass

Better authentication for HTTP
BSD 3-Clause "New" or "Revised" License
73 stars 4 forks source link

Add support for custom mail template #13

Closed namsral closed 7 years ago

namsral commented 7 years ago

Overwrite the default mail template to allow a custom subject and body.

Define the location of the mail template In the configuration:

multipass {
    mail_from "Multipass <no-reply@dallas>"
    mail_tmpl /var/lib/multipass/mail.tmpl
}

Available template values:

Example overriding the optional subject, the plain and html body:

{{ define "subject" -}}
Secure login to example.com
{{- end }}

{{ define "text/plain" }}
Hi,

You requested a secure login request. Please follow the link to login.

    {{.LoginURL}}

Didn't request a secure login? Please ignore this message, no harm done.

Be secure,

Login Bot
{{ end }}

{{ define "text/html" }}
<p>Hi,<p>

<p>You requested a secure login request. Please follow the link to login.</p>

<p><a href="{{.LoginURL}}">login link to example.com</a></p>

<p>Didn't request a secure login? Please ignore this message, no harm done.</p>

<p>Be secure,</p>

<p>Login Bot</p>
{{ end }}