Class: Mailflow::SendRawMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/mailflow/send_raw_message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SendRawMessage

Returns a new instance of SendRawMessage.



8
9
10
11
# File 'lib/mailflow/send_raw_message.rb', line 8

def initialize(client)
  @client = client
  @attributes = {}
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



6
7
8
# File 'lib/mailflow/send_raw_message.rb', line 6

def attributes
  @attributes
end

Instance Method Details

#data(data) ⇒ Object



27
28
29
# File 'lib/mailflow/send_raw_message.rb', line 27

def data(data)
  @attributes[:data] = Base64.encode64(data)
end

#mail_from(address) ⇒ Object



18
19
20
# File 'lib/mailflow/send_raw_message.rb', line 18

def mail_from(address)
  @attributes[:mail_from] = address
end

#rcpt_to(*addresses) ⇒ Object



22
23
24
25
# File 'lib/mailflow/send_raw_message.rb', line 22

def rcpt_to(*addresses)
  @attributes[:rcpt_to] ||= []
  @attributes[:rcpt_to] += addresses
end

#send!Object



13
14
15
16
# File 'lib/mailflow/send_raw_message.rb', line 13

def send!
  api = @client.moonrope.request(:send, :raw, @attributes)
  handle_api_response(api)
end