defmodule CartosnapApp.Trips.TripNotifier do
@moduledoc "Mail about trips: an invite to join one."
import Swoosh.Email
alias CartosnapApp.Mailer
@doc "Sends an invite to `email` with its link."
def deliver_invite(email, inviter_name, trip, url) do
email =
new()
|> to(email)
|> from(Mailer.sender())
|> subject("#{inviter_name} invited you to #{trip.name} on CartoSnap")
|> text_body("""
Hi,
#{inviter_name} invited you to #{trip.name}, a shared photo album on CartoSnap.
Join to see everyone's photos from the trip on a map, and add your own:
#{url}
The link works once and lasts a week. If you weren't expecting this,
you can ignore it.
""")
with {:ok, _metadata} <- Mailer.deliver(email), do: {:ok, email}
end
end
neiam
/cartosnap_ex
public · Issues · Pulls · Labels · Forks · Compare · Actions queued · Badges · Packages
⭐
Log in to mark this repository.
816 B · text
History
e569b6d