Skip to content

Instantly share code, notes, and snippets.

@smsohan
Created September 15, 2010 05:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smsohan/580272 to your computer and use it in GitHub Desktop.
Save smsohan/580272 to your computer and use it in GitHub Desktop.
#Instead of the following
Mail::Configuration.instance.retriever_method :pop3, pop3_options_hash
Mail.all.each do |mail|
...
end
#I would like to write one of the following
#1. The following line will instantiate a receiver using the global config
email_receiver = Mail::Receiver.new
#2. However, this one will only initialize the instance with specific options
email_receiver = Mail::Receiver.new :pop3, pop3_options_hash
#3. One can also take a hybrid approach, that is starting with the defaults and making customization as follows
email_receiver = Mail::Receiver.new
email_receiver.user_name = 'my_custom_inbox@example.org'
email_receiver.enable_ssl = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment