Skip to content

Commit

Permalink
Add module to send the email created
Browse files Browse the repository at this point in the history
  • Loading branch information
erickmp07 committed Oct 22, 2021
1 parent eb8ae4e commit 2e861e4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/inmana/supplies/expiration_notification.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule Inmana.Supplies.ExpirationNotification do
alias Inmana.Mailer
alias Inmana.Supplies.{ExpirationEmail, GetByExpiration}

def send do
data = GetByExpiration.call()

Enum.each(data, fn {to_email, supplies} ->
to_email
|> ExpirationEmail.create(supplies)
|> Mailer.deliver_later!()
end)
end
end

0 comments on commit 2e861e4

Please sign in to comment.