Skip to content

Instantly share code, notes, and snippets.

@maliabadi
Created October 26, 2012 07:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maliabadi/3957509 to your computer and use it in GitHub Desktop.
Save maliabadi/3957509 to your computer and use it in GitHub Desktop.
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