Closed nstuyvesant closed 3 years ago
Hi @nstuyvesant
You can pass the payload as a simple JSON for the /smtp/email
route.
let defaultClient = SibApiV3Sdk.ApiClient.instance;
let apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = 'YOUR_API_KEY';
let apiInstance = new SibApiV3Sdk.TransactionalEmailsApi();
let sendSmtpEmail = {
"subject": "My {{params.subject}}",
"htmlContent": "<html><body><h1>This is my first transactional email {{params.parameter}}</h1></body></html>",
"sender": {"name":"John Doe","email":"example@example.com"},
"to": [{"email":"example@example.com","name":"Jane Doe"}],
"cc": [{"email":"example@example.com","name":"Janice Doe"}],
"replyTo": {"email":"example@example.com","name":"John Doe"},
"headers": {"Some-Custom-Name":"unique-id-1234"},
"params": {"parameter":"My param value","subject":"New Subject"}
};
apiInstance.sendTransacEmail(sendSmtpEmail).then(function(data) {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function(error) {
console.error(error);
});```
Thanks,
Shubham
Per @ekta-slit, this is an example of how to send a transactional email:
Would like to request support for a constructors like this:
Thanks, Nate