-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathexample.rb
More file actions
36 lines (28 loc) · 999 Bytes
/
example.rb
File metadata and controls
36 lines (28 loc) · 999 Bytes
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
require './api/sendpulse_api'
require 'yaml'
API_CLIENT_ID = ''
API_CLIENT_SECRET = ''
API_PROTOCOL = 'https'
API_TOKEN = ''
sendpulse_api = SendpulseApi.new(API_CLIENT_ID, API_CLIENT_SECRET, API_PROTOCOL, API_TOKEN)
result = sendpulse_api.get_token
YAML::dump(result)
result = sendpulse_api.create_campaign('Name', 'example@gmail.com', 'Example subject', '<html><b>Example</b></html>', 'book_id') #+
YAML::dump(result)
result = sendpulse_api.add_sender('Some name', 'example@gmail.com')
YAML::dump(result)
result = sendpulse_api.get_balance
YAML::dump(result)
email = {
html: '<html><body><H1>TEXT</H1></body></html>',
text: 'TEST',
subject: 'Test, test test test',
from: { name: 'some', email: 'example@gmail.com' },
to: [
{ name: 'some1', email: 'example1@gmail.com' },
{ name: 'some3', email: 'example3@divermail.com' },
],
bcc: [{ name: 'some2', email: 'example2@gmail.com' }]
}
result = sendpulse_api.smtp_send_mail(email)
YAML::dump(result)