Created
August 31, 2018 14:01
-
-
Save bvjebin/91e3eae304c8924020cad021c812e252 to your computer and use it in GitHub Desktop.
send email with bamboo for medium post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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