-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bcc headers are stripped in MailComposer #1342
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Option 1 is not backwards compatible. Luckily, var mailOptions = {
...
bcc: 'bcc@example.com'
}
var mail = new MailComposer(mailOptions).compile()
mail.keepBcc = true
mail.build(function(err, message){
process.stdout.write(message);
}); If using TypeScript, just add |
I can confirm that the code above fixes it. Thanks! |
I had the same issue today, @danielepolencic can you reopen this issue? |
The Bcc field usage has been documented here. I agree that this is counterintuitive and bad API design, but it has worked like this for 10+ years already, and I'm not really up to changing Nodemailer's API anymore. |
@andris9 I could be wrong, but I think @gojevicmario meant that the type definition in |
@AnandChowdhary the typings for Nodemailer are community-maintained. I have no means to modify these. You would have to connect to the persons maintaining the typings file and ask them to update it. |
Thank you! I have opened a discussion here: DefinitelyTyped/DefinitelyTyped#69409 |
This issue is related to
MailComposer
andMimeNode
.With
MailComposer
I can create an email with a Bcc header like this:However, when the email is built, the Bcc is removed:
Digging in the code reveals that the Bcc header is removed by
MimeNode
unless you setkeepBcc: true
in the constructor.nodemailer/lib/mime-node/index.js
Line 33 in efc3947
Unfortunately, there is no way to pass an argument to MailComposer that cascades to MimeNode (at least from my initial investigation).
I can think about two options to make this work:
bcc
is set in MailComposer, make sure thatkeepBcc
is true in MimeNode.I don't fully grasp the implications of 2) and I suspect it's not straightforward. If 1) is doable, I can raise a PR along the lines of
in
nodemailer/lib/mail-composer/index.js
Lines 471 to 491 in efc3947
add this one liner:
I believe the same change has to be extended to the next block too.
The text was updated successfully, but these errors were encountered: