-
-
Save abelsonlive/3961189 to your computer and use it in GitHub Desktop.
requiring gems
This file contains hidden or 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
# 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 => '[email protected]', | |
: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