smail
Write HTML compliant email with peace of mind like Lustre ๐
gleam add smail@2
import gleam/io
import gleam/option.{Some}
import smail/attribute
import smail/email
import smail/html
import smail/style
pub fn main() {
let mail =
email.html([attribute.lang("en"), attribute.dir("ltr")], [
email.head([], [
email.font(
family: "Josefin Sans",
fallback_family: [email.Verdana],
web_font: Some(email.WebFont(
url: "https://fonts.gstatic.com/s/josefinsans/v32/Qw3aZQNVED7rKGKxtqIqX5EUDXx4.woff2",
format: email.Woff2,
)),
weight: Some(email.Weight400),
style: Some(email.StyleNormal),
),
]),
email.body([style.background_color("#fffbe8")], [
email.preview(
"No more tables by hand. Just write your email and relax ๐",
),
email.container([], [
email.section(
[
style.padding("0.75rem 1.5rem"),
style.background_color("#292d3e"),
style.border_radius("0.5rem"),
style.color("#fefefc"),
],
[
email.paragraph(
[
style.margin("0"),
style.margin_bottom("0.5rem"),
style.font_size("1.125rem"),
style.line_height("1.75rem"),
],
[
html.text("Write emails "),
html.span(
[
style.color("#ffaff3"),
style.font_weight("600"),
],
[html.text("with peace of mind")],
),
html.text("."),
],
),
email.paragraph(
[
style.margin("0"),
style.margin_bottom("0.5rem"),
style.color("#d4d4d4"),
style.font_size("1rem"),
style.line_height("1.5rem"),
],
[
html.text(
"No more tables by hand. Just write your email and relax ๐",
),
],
),
email.section([style.margin("1rem 0")], [
email.hr([]),
]),
email.center([], [
email.button(
[
style.border_radius("100px"),
style.background_color("#ffaff3"),
style.color("#1e1e1e"),
style.padding("12px 32px 11px"),
attribute.href("https://hexdocs.pm/smail"),
],
[html.text("Get started")],
),
]),
],
),
]),
]),
])
mail
|> email.to_html
|> io.println
mail
|> email.to_plain_text
|> io.println
}
Further documentation can be found at https://hexdocs.pm/smail.