A small DSL to build Mailto links. See more rfc6068.
Definition
String
Just a String
alias
mailto : Email -> Mailto
Constructs an empty Mailto with no parameters. It’s the singleton
of Mailto
.
mailtoMultiple : List Email -> Mailto
Constructs an empty Mailto with no parameters, but with mailtoMultiple recipients. It’s the singleton
of Mailto
.
mailtoNobody : Mailto
Constructs an empty Mailto with no parameters, but has no email addresses (useful when you want a blank message template). It’s the singleton
to Mailto
.
inReplyTo : String -> Endo Mailto
Adds an Message-ID to reply to in order to preserve threading mailto "list@example.org" |> inReplyTo "3469A91.D10AF4C@example.com" |> toString -- list@example.org?In-Reply-To=%3C3469A91.D10AF4C@example.com%3E
subject : String -> Endo Mailto
Adds a subject to the mailto
mailto "partner@test.mail"
|> subject "I want to cook you dinner"
|> toString
-- "mailto:partner@test.mail?subject=I%20want%20to%20cook%20you%20dinner"
cc : List Email -> Endo Mailto
Adds carbon copies to the mailto
mailto "partner@test.mail"
|> cc [ "cc@test.mail", "mutualfriend@test.mail" ]
|> toString
-- "mailto:partner@test.mail?cc=cc@test.mail,mutualfriend@test.mail"
bcc : List Email -> Endo Mailto
Adds blind carbon copies to the mailto
mailto "partner@test.mail"
|> bcc [ "bcc@test.mail", "secretfriend@test.mail" ]
|> toString
-- "mailto:partner@test.mail?bcc=bcc@test.mail,secretfriend@test.mail"
body : String -> Endo Mailto
Adds a body to the mailto
mailto "partner@test.mail"
|> body "I’ll be making a spicy, Isaan nam dtok muu salad (น้ำตกหมู)."
|> toString
-- "mailto:partner@test.mail?body=I%E2%80%99ll%20be%20making%20a%20spicy,%20Isaan%20nam%20dtok%20muu%20salad%20(%E0%B8%99%E0%B9%89%E0%B8%B3%E0%B8%95%E0%B8%81%E0%B8%AB%E0%B8%A1%E0%B8%B9)."
header : String -> String -> Endo Mailto
Appends additional key-value pair headers
toString : Mailto -> String
After composing a Mailto
, consume a string
toHref : Mailto -> Html.Attribute msg
For convenience, you can turn a Mailto
into an Html.Attribute
as well