Last active
December 23, 2015 21:49
-
-
Save mikeadmire/6699352 to your computer and use it in GitHub Desktop.
Send email using remote server with Ruby. `gem install mail`
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
require 'mail' | |
module MailFile | |
def email_it | |
options = { address: "email.server.example.com" } | |
Mail.defaults { delivery_method :smtp, options } | |
Mail.deliver do | |
from 'whoami@example.com' | |
to ['user1@example.com', 'user2@example.com'] | |
subject 'Here is an awesome email for you' | |
body 'Heya! Here is that doc I promised you.' | |
add_file './amazing_report.csv' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment