Node.js › Email & Notifications
What is the difference between the 'to', 'cc', and 'bcc' fields when sending an email programmatically, and why does 'bcc' matter for privacy?
BeginnerAnswer
'to' and 'cc' (carbon copy) recipients are visible to every other recipient of the email, while 'bcc' (blind carbon copy) recipients receive the email without their address being visible to anyone else on the message -- this matters significantly when sending the same email to a list of unrelated users, where using 'to' or 'cc' for the whole list would expose every recipient's email address to every other recipient, a privacy mistake often made by accident.
// Privacy risk: every recipient sees everyone else's email address
await transporter.sendMail({ to: allUserEmails.join(','), subject: 'Update' });
// Better for a shared announcement to unrelated users
await transporter.sendMail({ to: 'noreply@example.com', bcc: allUserEmails.join(','), subject: 'Update' });Real-world example A company accidentally exposed the email addresses of hundreds of newsletter subscribers by putting them all in the 'to' field of a single email instead of 'bcc', a mistake corrected in their process by always using bcc for bulk sends to unrelated recipients going forward.