-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbasicSendWithRetry.js
More file actions
40 lines (33 loc) · 1 KB
/
basicSendWithRetry.js
File metadata and controls
40 lines (33 loc) · 1 KB
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
const { SocketLabsClient, EmailAddress, BasicMessage } = require('../../src/socketlabsClient');
const exampleConfig = require('../exampleConfig');
/**
* Build the message
*/
var message = new BasicMessage();
message.subject = "Sending An Email Through A Proxy";
message.htmlBody = "<html><body><h1>Sending An Email Through A Proxy</h1><p>This is the Html Body of my message.</p></body></html>";
message.textBody = "This is the Plain Text Body of my message.";
message.from = new EmailAddress("from@example.com");
message.to.push("recipient@example.com");
/**
* Create the client
*/
var client = new SocketLabsClient(exampleConfig.ServerId, exampleConfig.ApiKey,
{
optionalProxy: "http://localhost:4433"
});
client.numberOfRetries = 3;
/**
* Send the message
*/
client.requestTimeout = 20;
client.send(message).then(
(res) => {
console.log("Promise resolved: ")
console.log(res)
},
(err) => {
console.log("Promise rejected: ")
console.log(err)
}
);