i create this nodejs app to send emails for marcketing using sendgrid Api, in fact it's working but i have a problem that i have to remove param message to: 'exemple@gmail.com'
and not display it in the email just the bcc recipients, this is the code:
require("dotenv").config();
const sgMail = require('@sendgrid/mail')
const fs = require("fs");
sgMail.setApiKey(process.env.SENDGRID_API_KEY)
const msg = {
to: 'exemple@gmail.com',
from: 'exemple1@gmail.com',
bcc: ['exemple2@gmail.com','exemple3@gmail.com','exemple4@gmail.com'],
subject: 'Sending Emails Using Sendgrid',
html: '<p>Sending Emails Using Sendgrid</p><br><img src="cid:logo" alt="image" />',
attachments: [{
filename: 'img',
type: 'image/png',
content_id: 'logo',
content: fs.readFileSync('imgs/img.png', { encoding: 'base64' }),
disposition: 'inline',
}],
};
sgMail.send(msg).then(() => {
console.log('Email sent')
}).catch((error) => {
console.error(error)
});