class MicrosoftActionmailer::DeliveryMethod

Attributes

access_token[R]
delivery_options[R]

Public Class Methods

new(params) click to toggle source
# File lib/microsoft_actionmailer.rb, line 19
def initialize params
        @access_token = params[:authorization]
        @delivery_options = params[:delivery_options] || {}
end

Public Instance Methods

deliver!(mail) click to toggle source
# File lib/microsoft_actionmailer.rb, line 24
def deliver! mail
        message = ms_create_message(
                access_token,
                mail.subject,
                mail.body.encoded,
                mail.to.first
        )

        before_send = delivery_options[:before_send]
        if before_send && before_send.respond_to?(:call)
                before_send.call(mail, message)
        end

        res = ms_send_message(access_token, message['id'])

        after_send = delivery_options[:after_send]
        if after_send && after_send.respond_to?(:call)
                after_send.call(mail, message)
        end
end