devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
Mail::Message#add_file
Adds a file to the message. You have two options with this method, you can
just pass in the absolute path to the file you want and Mail will read the file,
get the filename from the path you pass in and guess the MIME media type, or you
can pass in the filename as a string, and pass in the file content as a blob.
Example:
m = Mail.new
m.add_file('/path/to/filename.png')
m = Mail.new
m.add_file(:filename => 'filename.png', :content => File.read('/path/to/file.jpg'))
Note also that if you add a file to an existing message, Mail will convert that message
to a MIME multipart email, moving whatever plain text body you had into its own text
plain part.
Example:
m = Mail.new do
body 'this is some text'
end
m.multipart? #=> false
m.add_file('/path/to/filename.png')
m.multipart? #=> true
m.parts.first.content_type.content_type #=> 'text/plain'
m.parts.last.content_type.content_type #=> 'image/png'
See also #attachmentsEdit
git clone [email protected]:plataformatec/devise.git
cd devise
open
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Mail--Message-add_file-for-pr
# Commit to gitgit add git commit -m "better docs for Mail::Message#add_file"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Mail--Message-add_file-for-pr
hub pull-request
# Celebrate!