carrierwave

https://github.com/carrierwaveuploader/carrierwave

Ruby

Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks

Mail.defaults

Sets the default delivery method and retriever method for all new Mail objects.
The delivery_method and retriever_method default to :smtp and :pop3, with defaults
set.

So sending a new email, if you have an SMTP server running on localhost is
as easy as:

  Mail.deliver do
    to      '[email protected]'
    from    '[email protected]'
    subject 'hi there!'
    body    'this is a body'
  end

If you do not specify anything, you will get the following equivalent code set in
every new mail object:

  Mail.defaults do
    delivery_method :smtp, { :address              => "localhost",
                             :port                 => 25,
                             :domain               => 'localhost.localdomain',
                             :user_name            => nil,
                             :password             => nil,
                             :authentication       => nil,
                             :enable_starttls_auto => true  }

    retriever_method :pop3, { :address             => "localhost",
                              :port                => 995,
                              :user_name           => nil,
                              :password            => nil,
                              :enable_ssl          => true }
  end

  Mail.delivery_method.new  #=> Mail::SMTP instance
  Mail.retriever_method.new #=> Mail::POP3 instance

Each mail object inherits the default set in Mail.delivery_method, however, on
a per email basis, you can override the method:

  mail.delivery_method :smtp

Or you can override the method and pass in settings:

  mail.delivery_method :smtp, :address => 'some.host'

Source | Google | Stack overflow

Edit

git clone [email protected]:carrierwaveuploader/carrierwave.git

cd carrierwave

open

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Mail-defaults-for-pr


# Commit to git

git add git commit -m "better docs for Mail.defaults"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Mail-defaults-for-pr

hub pull-request


# Celebrate!