Method: Mail.deliver
- Defined in:
- lib/mail/mail.rb
.deliver(*args, &block) ⇒ Object
Send an email using the default configuration. You do need to set a default configuration first before you use self.deliver, if you don’t, an appropriate error will be raised telling you to.
If you do not specify a delivery type, SMTP will be used.
Mail.deliver do
to '[email protected]'
from '[email protected]'
subject 'This is a test email'
body 'Not much to say here'
end
You can also do:
mail = Mail.read('email.eml')
mail.deliver!
And your email object will be created and sent.
131 132 133 134 135 |
# File 'lib/mail/mail.rb', line 131 def self.deliver(*args, &block) mail = self.new(args, &block) mail.deliver mail end |