Skip to content

Instantly share code, notes, and snippets.

@mikeadmire
Last active December 23, 2015 21:49
Show Gist options
  • Save mikeadmire/6699352 to your computer and use it in GitHub Desktop.
Save mikeadmire/6699352 to your computer and use it in GitHub Desktop.
Send email using remote server with Ruby. `gem install mail`
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