-
Notifications
You must be signed in to change notification settings - Fork 4
/
basic_send_with_amp_body.rb
49 lines (39 loc) · 1.56 KB
/
basic_send_with_amp_body.rb
1
2
3
4
5
6
7
8
9
10
11
12
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
require_relative "../../lib/socketlabs-injectionapi.rb"
require "json"
class BasicSendWithAmpBody
include SocketLabs::InjectionApi
include SocketLabs::InjectionApi::Core
include SocketLabs::InjectionApi::Message
def get_message
message = BasicMessage.new
message.subject = "Sending A Test Message (Basic Send With AMP Body)"
message.html_body = "<html>" +
"<body>" +
"<h1>Sending A Test Message</h1>" +
"<p>This HTML will show if AMP is not supported on the receiving end of the email.</p>" +
"</body>" +
"</html>"
message.amp_body ="<!doctype html>" +
"<html amp4email>" +
" <head>" +
" <meta charset=\"utf-8\">" +
" <script async src=\"https://cdn.ampproject.org/v0.js\"></script>" +
" <style amp4email-boilerplate>body{visibility:hidden}</style>" +
" <style amp-custom>" +
" h1 {" +
" margin: 1rem;" +
" }" +
" </style>" +
" </head>" +
" <body>" +
" <h1>This is the AMP Html Body of my message</h1>" +
" </body>" +
"</html>"
message.from_email_address = EmailAddress.new("[email protected]")
message.add_to_email_address("[email protected]")
message.add_to_email_address("[email protected]", "Recipient #2")
message.add_to_email_address(EmailAddress.new("[email protected]"))
message.add_to_email_address(EmailAddress.new("[email protected]", "Recipient #4"))
message
end
end