36 lines
848 B
Elixir
36 lines
848 B
Elixir
|
Mix.install(
|
||
|
[
|
||
|
{:swoosh, "~> 1.7"},
|
||
|
{:gen_smtp, "~> 1.1"},
|
||
|
{:hackney, "~> 1.8"},
|
||
|
{:swoosh_mailinator, path: "."}, #app: false }
|
||
|
]
|
||
|
)
|
||
|
|
||
|
defmodule Main do
|
||
|
import Swoosh.Email
|
||
|
import Swoosh.Mailer
|
||
|
|
||
|
def main do
|
||
|
mess = """
|
||
|
Compose, deliver and test your emails easily in Elixir.
|
||
|
|
||
|
Swoosh comes with many adapters, including SendGrid, Mandrill, Mailgun, Postmark and SMTP. See the full list of adapters below.
|
||
|
|
||
|
The complete documentation for Swoosh is available online at HexDocs.
|
||
|
"""
|
||
|
new()
|
||
|
|> to("mlkjhg@kiujygtrfedc.com")
|
||
|
|> from({"Who Knows", "who.knows@nonexisting.tld"})
|
||
|
|> subject("Hello, Swoosh!")
|
||
|
|> html_body("<h1>Hello World</h1><p>"<>mess<>"</p>")
|
||
|
|> text_body(mess)
|
||
|
|> IO.inspect()
|
||
|
|> deliver([
|
||
|
adapter: Swoosh.Adapters.Mailinator
|
||
|
])
|
||
|
end
|
||
|
end
|
||
|
|
||
|
Main.main() |> IO.inspect()
|