Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
requiring gems
# this feels weird, but there's some magic here. Ruby knows where 'rubygems' is without you having to explain it with an exact path.
require 'rubygems'
# now you can you just flat-out require ANY gem you have installed! like
require 'pony'
# all of the sudden you have this really cool ruby library called 'pony' in your application's object space! And you can do shit like this:
Pony.mail({
:to => 'matt@cutt.com',
:via => :smtp,
:via_options => {
:address => 'smtp.gmail.com',
:port => '587',
:enable_starttls_auto => true,
:user_name => 'matt',
:password => 'whatever',
:authentication => :plain, # :plain, :login, :cram_md5, no auth by default
:domain => "localhost.localdomain" # the HELO domain provided by the client to the server
}
:subject => 'Hi!',
:body => 'This is an actual fucking email that would be sent out.'
})
# check out Pony's github page for more examples: https://github.com/benprew/pony
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.