DetectEmailSettings

This gem is intended to detect email settings for use with Mikel Lindsaar's mail gem. The idea is that a user can give your site their email address and password and the correct connection settings will be auto-detected.

Installation

Add this line to your application's Gemfile:

gem 'detect_email_settings'

And then execute:

$ bundle

Or install it yourself as:

$ gem install detect_email_settings

Usage

To guess detect email settings for all possible mail servers. This process can take up to 10 minutes for some server configurations and is not guaranteed to work. If you need faster service you may consider using C.

settings = DetectEmailSettings.detect_settings('[email protected]', 'password')
if settings.nil?
  puts "Couldn't detect email settings."
else
  Mail.defaults do
    retriever_method settings[:method],
                        :address    => settings[:address],
                        :port       => settings[:port],
                        :user_name  => settings[:user_name],
                        :password   => settings[:password],
                        :enable_ssl => settings[:enable_ssl]
  end
end

You will get almost immediate results using C. This checks for major free or premium mail services with known connection settings.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request