Skip to content

Instantly share code, notes, and snippets.

@bvjebin
Created August 31, 2018 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvjebin/91e3eae304c8924020cad021c812e252 to your computer and use it in GitHub Desktop.
Save bvjebin/91e3eae304c8924020cad021c812e252 to your computer and use it in GitHub Desktop.
send email with bamboo for medium post
def send_email(email, csv_path, zip_path) do
attachments = if !is_nil(zip_path) do
[Bamboo.Attachment.new(zip_path)]
else
[]
end
attachments = [Bamboo.Attachment.new(csv_path) | attachments]
new_email(attachments: attachments)
|> subject("Your download is here")
|> from("support@example.com")
|> to(email)
|> html_body("<strong>PFA</strong>")
|> text_body("PFA")
|> Mailer.deliver_later
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment