Let us say I want to send an email to recipient@xyz.com
with bcc copy sent to bcc@xyz.com
.
When bcc@xyz.com
is receiving an email he should see recipient@xyz.com
in the To field, and bcc@xyz.com
in the bcc field.
But when bcc@xyz.com
receives the email, he is not able to see recipient@xyz.com
in the To field.
I tried to create and send email using mail composer instead of transports but it is not working as expected.
I also tried cc but cc is not working as expected.
const nodemailer = require('nodemailer');
const testAccount = await nodemailer.createTestAccount();
const transporter = nodemailer.createTransport({
host: "smtp.ethereal.email",
auth: {
user: testAccount.user,
pass: testAccount.pass
},
tls: { rejectUnauthorized: false }
});
const mailData = {
from: 'xyz@xyz.com',
to: 'recipient@xyz.com',
bcc: 'bcc@xyz.com',
subject: 'Sample Mail',
html: text
}
const result = await transporter.sendMail(mailData);
console.log('Mail Sent! \t ID: ' + result.messageId);
When the email is received, I expect bcc@xyz.com to see recipient@xyz.com in the To: field.