13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/azure_communication_email/payload.rb', line 13
def as_json
hash = {
"senderAddress" => first_sender_address,
"content" => {
"subject" => @mail.subject.to_s,
"plainText" => plain_text_body
},
"recipients" => {
"to" => recipient_objects(:to)
}
}
if (name = first_sender_display_name).present?
hash["senderDisplayName"] = name
end
if (html = html_body).present?
hash["content"]["html"] = html
end
if (cc = recipient_objects(:cc)).present?
hash["recipients"]["cc"] = cc
end
if (bcc = recipient_objects(:bcc)).present?
hash["recipients"]["bcc"] = bcc
end
if (reply_to = recipient_objects(:reply_to)).present?
hash["replyTo"] = reply_to
end
if ( = ).present?
hash["headers"] =
end
if (attachments = attachment_objects).present?
hash["attachments"] = attachments
end
hash
end
|