class AppMail::SendRawMessage

Public Class Methods

new(client) click to toggle source
# File lib/app_mail/send_raw_message.rb, line 7
def initialize(client)
  @client = client
  @attributes = {}
end

Public Instance Methods

data(data) click to toggle source
# File lib/app_mail/send_raw_message.rb, line 32
def data(data)
  @attributes[:data] = Base64.encode64(data)
end
mail_from(address) click to toggle source
# File lib/app_mail/send_raw_message.rb, line 23
def mail_from(address)
  @attributes[:mail_from] = address
end
rcpt_to(*addresses) click to toggle source
# File lib/app_mail/send_raw_message.rb, line 27
def rcpt_to(*addresses)
  @attributes[:rcpt_to] ||= []
  @attributes[:rcpt_to] += addresses
end
send!() click to toggle source
# File lib/app_mail/send_raw_message.rb, line 12
def send!
  api = @client.moonrope.request(:send, :raw, @attributes)
  if api.success?
    SendResult.new(@client, api.data)
  elsif api.status == 'error'
    raise SendError.new(api.data['code'], api.data['message'])
  else
    raise Error, "Couldn't send message"
  end
end