feat: allow text message
This commit is contained in:
@@ -11,20 +11,42 @@ defmodule Main do
|
||||
import Swoosh.Email
|
||||
import Swoosh.Mailer
|
||||
|
||||
def main do
|
||||
mess = """
|
||||
Compose, deliver and test your emails easily in Elixir.
|
||||
def test_both() do
|
||||
prep()
|
||||
end
|
||||
|
||||
Swoosh comes with many adapters, including SendGrid, Mandrill, Mailgun, Postmark and SMTP. See the full list of adapters below.
|
||||
def test_text_only() do
|
||||
prep()
|
||||
|> Map.delete(:html_body)
|
||||
end
|
||||
|
||||
The complete documentation for Swoosh is available online at HexDocs.
|
||||
"""
|
||||
def test_text_nil() do
|
||||
prep()
|
||||
|> text_body(nil)
|
||||
end
|
||||
|
||||
def test_html_only() do
|
||||
prep()
|
||||
|> Map.delete(:text_body)
|
||||
end
|
||||
|
||||
def test_html_nil() do
|
||||
prep()
|
||||
|> html_body(nil)
|
||||
end
|
||||
|
||||
def prep do
|
||||
mess = "mess"
|
||||
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)
|
||||
end
|
||||
|
||||
def send(email) do
|
||||
email
|
||||
|> IO.inspect()
|
||||
|> deliver([
|
||||
adapter: Swoosh.Adapters.Mailinator
|
||||
@@ -32,4 +54,8 @@ The complete documentation for Swoosh is available online at HexDocs.
|
||||
end
|
||||
end
|
||||
|
||||
Main.main() |> IO.inspect()
|
||||
Main.test_both() |> Main.send() |> IO.inspect()
|
||||
Main.test_text_only() |> Main.send() |> IO.inspect()
|
||||
Main.test_html_only() |> Main.send() |> IO.inspect()
|
||||
Main.test_text_nil() |> Main.send() |> IO.inspect()
|
||||
Main.test_html_nil() |> Main.send() |> IO.inspect()
|
||||
|
Reference in New Issue
Block a user