class Outbox::Messages::Email

Email messages use the same interface for composing emails as Mail::Message from the mail gem. The only difference is the abstraction of the client interface, which allows you to send the email using whatever client you wish.

email = Outbox::Messages::Email.new do
  to 'nicolas@test.lindsaar.net.au'
  from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
  subject 'First multipart email sent with Mail'

  text_part do
    body 'This is plain text'
  end

  html_part do
    content_type 'text/html; charset=UTF-8'
    body '<h1>This is HTML</h1>'
  end
end
email.client :mandrill, api_key: '...'
email.deliver

Public Instance Methods

message_object() click to toggle source

Returns the internal Mail::Message instance

# File lib/outbox/messages/email.rb, line 50
def message_object
  @message
end

Protected Instance Methods

method_missing(method, *args, &block) click to toggle source
Calls superclass method
# File lib/outbox/messages/email.rb, line 68
def method_missing(method, *args, &block)
  if @message.respond_to?(method)
    @message.public_send(method, *args, &block)
  else
    super
  end
end
respond_to_missing?(method, include_private = false) click to toggle source
Calls superclass method
# File lib/outbox/messages/email.rb, line 76
def respond_to_missing?(method, include_private = false)
  super || @message.respond_to?(method, include_private)
end