devise
https://github.com/plataformatec/devise
Ruby
Flexible authentication solution for Rails with Warden.
Mail::Message#initialize
==Making an email You can make an new mail object via a block, passing a string, file or direct assignment. ===Making an email via a block mail = Mail.new do |m| m.from '[email protected]' m.to '[email protected]' m.subject 'This is a test email' m.body File.read('body.txt') end mail.to_s #=> "From: [email protected]\r\nTo: you@... If may also pass a block with no arguments, in which case it will be evaluated in the scope of the new message instance: mail = Mail.new do from '[email protected]' # … end ===Making an email via passing a string mail = Mail.new("To: [email protected]\r\nSubject: Hello\r\n\r\nHi there!") mail.body.to_s #=> 'Hi there!' mail.subject #=> 'Hello' mail.to #=> '[email protected]' ===Making an email from a file mail = Mail.read('path/to/file.eml') mail.body.to_s #=> 'Hi there!' mail.subject #=> 'Hello' mail.to #=> '[email protected]' ===Making an email via assignment You can assign values to a mail object via four approaches: * Message#field_name=(value) * Message#field_name(value) * Message#['field_name']=(value) * Message#[:field_name]=(value) Examples: mail = Mail.new mail['from'] = '[email protected]' mail[:to] = '[email protected]' mail.subject 'This is a test email' mail.body = 'This is a body' mail.to_s #=> "From: [email protected]\r\nTo: you@...
Edit
git clone [email protected]:plataformatec/devise.git
cd devise
open
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Mail--Message-initialize-for-pr
# Commit to gitgit add git commit -m "better docs for Mail::Message#initialize"
# 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-initialize-for-pr
hub pull-request
# Celebrate!