module Mail
def self.new(*args, &block)
mail['subject'] = 'This is an email'
mail[:from] = 'bob@test.lindsaar.net'
mail.to = 'mikel@test.lindsaar.net'
mail = Mail.new
symbol or direct method calls. See Mail::Message for more information.
a Mail::Message object directly and then passing in values via string,
As a side note, you can also create a new email through creating
and yield each key value pair.
does not need to be a hash, it just needs to respond to :each_pair
Note, the hash keys can be strings or symbols, the passed in object
:body => 'This is the body' })
:subject => 'This is an email',
'from' => 'bob@test.lindsaar.net',
message = Mail.new({:to => 'mikel@test.lindsaar.net',
Or creating via a hash (or hash like object):
end
body 'This is the body'
subject 'This is an email'
from 'bob@test.lindsaar.net'
to 'mikel@test.lindsaar.net'
message = Mail.new do
Or creating via a block:
Mail.new(string)
string << "This is the body"
string << "\r\n"
string << "Subject: This is an email\r\n"
string << "From: bob@test.lindsaar.net\r\n"
string = "To: mikel@test.lindsaar.net\r\n"
Creating via a string:
message:
For example, the following two examples will create the same email
You can make an email via passing a string or passing a block.
Allows you to create a new Mail::Message object.
def self.new(*args, &block) Message.new(args, &block) end