nodemailer gmail connection closed with high number of mails

后端 未结 2 1168
执笔经年
执笔经年 2021-01-20 06:51

I have exactly the same issue as this post : Send multipe emails using nodemailer and gmail

When sending too many emails with nodemailer and gmail, I get a 421 error

相关标签:
2条回答
  • 2021-01-20 07:20

    Use Pooled SMTP : https://nodemailer.com/smtp/pooled/

    If pooling is used then Nodemailer keeps a fixed amount of connections open and sends the next message once a connection becomes available. It is mostly useful when you have a large number of messages that you want to send in batches or your provider allows you to only use a small amount of parallel connections.

    0 讨论(0)
  • 2021-01-20 07:30

    You should add the pool parameter to your nodemailer transporter config object:

    export const transporter = nodemailer.createTransport({
      service: 'gmail',
      auth: {},
      pool: true
    });
    

    For additional configuration options, you can check here

    0 讨论(0)
提交回复
热议问题