File: //usr/local/rvm/gems/ruby-2.7.4/doc/mail-2.7.1/ri/Mail/new-c.ri
U:RDoc::AnyMethod[iI"new:ETI"Mail::new;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"5Allows you to create a new Mail::Message object.;To:RDoc::Markup::BlankLine o;
; [I"CYou can make an email via passing a string or passing a block.;T@o;
; [I"HFor example, the following two examples will create the same email ;TI"
message:;T@o;
; [I"Creating via a string:;T@o:RDoc::Markup::Verbatim; [I"0string = "To: mikel@test.lindsaar.net\r\n"
;TI"1string << "From: bob@test.lindsaar.net\r\n"
;TI"/string << "Subject: This is an email\r\n"
;TI"string << "\r\n"
;TI""string << "This is the body"
;TI"Mail.new(string)
;T:@format0o;
; [I"Or creating via a block:;T@o;; [I"message = Mail.new do
;TI"$ to 'mikel@test.lindsaar.net'
;TI"$ from 'bob@test.lindsaar.net'
;TI"" subject 'This is an email'
;TI" body 'This is the body'
;TI" end
;T;
0o;
; [I"2Or creating via a hash (or hash like object):;T@o;; [ I";message = Mail.new({:to => 'mikel@test.lindsaar.net',
;TI"< 'from' => 'bob@test.lindsaar.net',
;TI"9 :subject => 'This is an email',
;TI"8 :body => 'This is the body' })
;T;
0o;
; [I"INote, the hash keys can be strings or symbols, the passed in object ;TI"Hdoes not need to be a hash, it just needs to respond to :each_pair ;TI"#and yield each key value pair.;T@o;
; [I"FAs a side note, you can also create a new email through creating ;TI"La Mail::Message object directly and then passing in values via string, ;TI"Lsymbol or direct method calls. See Mail::Message for more information.;T@o;; [
I"mail = Mail.new
;TI")mail.to = 'mikel@test.lindsaar.net'
;TI"+mail[:from] = 'bob@test.lindsaar.net'
;TI"*mail['subject'] = 'This is an email'
;TI"#mail.body = 'This is the body';T;
0:
@fileI"lib/mail/mail.rb;T:0@omit_headings_from_table_of_contents_below000[ I"(*args, &block);T@FFI" Mail;TcRDoc::NormalModule00