-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempCodeRunnerFile.cjs
More file actions
36 lines (29 loc) · 1.21 KB
/
tempCodeRunnerFile.cjs
File metadata and controls
36 lines (29 loc) · 1.21 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
// Load the Brevo SDK
const SibApiV3Sdk = require('sib-api-v3-sdk');
// Configure API key authorization: api-key
const defaultClient = SibApiV3Sdk.ApiClient.instance;
const apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = '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'; // Replace with your actual API key
// Create an instance of the Transactional Emails API
const apiInstance = new SibApiV3Sdk.TransactionalEmailsApi();
// Prepare email send request
const sendSmtpEmail = new SibApiV3Sdk.SendSmtpEmail();
// Email sender info
sendSmtpEmail.sender = {
name: 'Big Bull',
email: 'miharshad88@gmail.com' // Your verified sender email
};
// Recipient list
sendSmtpEmail.to = [{
email: 'atharv.khisti2004@gmail.com', // Recipient's email
name: 'Harshad Jadhva'
}];
// Email subject and content
sendSmtpEmail.subject = 'Test Email from Brevo API';
sendSmtpEmail.textContent = 'Hello! This is a test email sent via Brevo API.';
// Send the email
apiInstance.sendTransacEmail(sendSmtpEmail).then((data) => {
console.log('Email sent successfully:', data);
}, (error) => {
console.error('Error sending email:', error);
});