Skip to content
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

[fix] Use pooling for connections #469

Open
3 tasks done
Martin-Tabya opened this issue Dec 19, 2024 · 0 comments
Open
3 tasks done

[fix] Use pooling for connections #469

Martin-Tabya opened this issue Dec 19, 2024 · 0 comments
Labels

Comments

@Martin-Tabya
Copy link

Describe the bug

Node.js version: Happens with all nodeJS versions

OS version: Happens in all environments

Description:

When many sequential emails are send, there is a point at which they start to fail with a Invalid login: 421 .... too manny connections from <IP>.
I'm pretty sure I found the bug and also the solution, have a look at this comment: nodemailer/nodemailer#699 (comment)

There should be an easy to configure way to use pooling for sending out batches. As I understand the code right now, we could pass a custom transport-object to the constructor, but that would still result in nodemailer.createTransport() beeing called every time a new Email is send (by new Email()), which would always recreate the transport-object and so circumvent the pooling.

An easy usePooling option would be lovely, also it might make sense to store the original passed config.transport object in a static field. This way it doesn't get re-created on every single email-send.

This fix should be pretty easy and traight forwarded and it would help a lot of users I think :)

Can you find the time for that? Or is that at least something you would agree is a useful change?

Code to reproduce

Just sending multiple mails via new Email() causes the problem.

The amunt of emails at which the problem occurs seems to be related to the environment and node-version etc. In our case it's around 40-50.

Checklist

  • I have searched through GitHub issues for similar issues.
  • I have completely read through the README and documentation.
  • I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant