Nodemailer 不遵守 rateDelta 和 rateLimit
Nodemailer is not respecting rateDelta and rateLimit
我为这样的电子邮件创建了一个池传输:
const nodemailer = require('nodemailer');
let poolNewsletterEmail;
let poolGeneralEmail;
exports.createTransporter= function(callback) {
// create reusable transporter object using the default SMTP transport
poolNewsletterEmail = nodemailer.createTransport({
pool: true,
logger: true,
secure: true, // use SSL
rateDelta: 86400000, //24 Hours
rateLimit: 2,
host: process.env.EMAIL_HOST_NEWSLETTER,
port: process.env.EMAIL_PORT_NEWSLETTER,
auth: {
user: process.env.EMAIL_USER_NEWSLETTER,
pass: process.env.EMAIL_PASSWORD_NEWSLETTER,
},
});
callback()
};
exports.getNewsletterPool = function() {
return poolNewsletterEmail;
};
我是这样吃的:
const info = await emailTransporter.getNewsletterPool().sendMail(mailOptions).catch(console.error);
这是日志
$ npm start
> ao-api-server@1.0.0 start C:\ao-api-server
> node index.js
[2020-03-30 08:25:39] DEBUG Creating transport: nodemailer (6.4.6; +https://nodemailer.com/; SMTP (pool)/6.4.6[client:6.4.6])
[2020-03-30 08:25:39] DEBUG Creating transport: nodemailer (6.4.6; +https://nodemailer.com/; SMTP (pool)/6.4.6[client:6.4.6])
Transportador de email general creado con exito para el email: argentumonline@riseup.net
Transportador de email newsletter creado con exito para el email: aolibre@gmail.com
Conexion a la BD MySQL Exitosa!K[0m
Argentum Online API on Port:- 1337 Started at :- Mon Mar 30 2020 21:25:39 GMT+1300 (New Zealand Daylight Time)
Logged in Discord as AO Libre BOT#6711!
sendNewsletterEmail: El subject asdasdasdasdasd
Hay que enviar 1905 emails
Se esta enviando un email de newsletter a: HEN.H2O@LIVE.COM.AR
[2020-03-30 08:25:57] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:25:57] INFO [#1] Created new pool resource #1
[2020-03-30 08:25:57] DEBUG [#1] Assigned message <e8bc3a91-1131-c41a-7e9f-f887a9f7b217@gmail.com> to #1 (1)
[2020-03-30 08:25:57] DEBUG [8YiRWBx0hR4] Resolved smtp.gmail.com as 74.125.130.108 [cache miss]
[2020-03-30 08:25:58] INFO [8YiRWBx0hR4] Secure connection established to 74.125.130.108:465
[2020-03-30 08:25:58] DEBUG [8YiRWBx0hR4] SMTP handshake finished
[2020-03-30 08:25:58] INFO [8YiRWBx0hR4] User "aolibre@gmail.com" authenticated
[2020-03-30 08:25:58] INFO [#1] Sending message <e8bc3a91-1131-c41a-7e9f-f887a9f7b217@gmail.com> using #1 to <argentumonline@riseup.net>
[2020-03-30 08:26:00] INFO [8YiRWBx0hR4] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: HEN.H2O@LIVE.COM.AR
Se esta enviando un email de newsletter a: M@M.COM
[2020-03-30 08:26:01] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:01] DEBUG [#1] Connection #1 became available
[2020-03-30 08:26:01] DEBUG [#1] Assigned message <65afa327-b754-81e5-361d-243d29673b1a@gmail.com> to #1 (2)
[2020-03-30 08:26:01] INFO [#1] Sending message <65afa327-b754-81e5-361d-243d29673b1a@gmail.com> using #1 to <argentumonline@riseup.net>
[2020-03-30 08:26:02] INFO [8YiRWBx0hR4] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: M@M.COM
Se esta enviando un email de newsletter a: SHAI_05@HOTMAIL.COM
[2020-03-30 08:26:03] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:03] INFO [#2] Created new pool resource #2
[2020-03-30 08:26:03] DEBUG [#2] Assigned message <b465d175-8518-f64c-4f92-3a6cd2d19d5a@gmail.com> to #2 (1)
[2020-03-30 08:26:03] DEBUG [k1JVRGXrL00] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:03] INFO [k1JVRGXrL00] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:04] DEBUG [k1JVRGXrL00] SMTP handshake finished
[2020-03-30 08:26:04] INFO [k1JVRGXrL00] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:04] INFO [#2] Sending message <b465d175-8518-f64c-4f92-3a6cd2d19d5a@gmail.com> using #2 to <argentumonline@riseup.net>
[2020-03-30 08:26:05] INFO [k1JVRGXrL00] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: SHAI_05@HOTMAIL.COM
Se esta enviando un email de newsletter a: NADIE@GMAIL.COM
[2020-03-30 08:26:07] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:07] INFO [#3] Created new pool resource #3
[2020-03-30 08:26:07] DEBUG [#3] Assigned message <f2137568-1317-4927-db2a-717e52681e32@gmail.com> to #3 (1)
[2020-03-30 08:26:07] DEBUG [XCYpzqbxy50] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:07] INFO [XCYpzqbxy50] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:07] DEBUG [XCYpzqbxy50] SMTP handshake finished
[2020-03-30 08:26:08] INFO [XCYpzqbxy50] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:08] INFO [#3] Sending message <f2137568-1317-4927-db2a-717e52681e32@gmail.com> using #3 to <argentumonline@riseup.net>
[2020-03-30 08:26:09] INFO [XCYpzqbxy50] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: NADIE@GMAIL.COM
Se esta enviando un email de newsletter a: JOAQUINBACA7@GMAIL.COM
[2020-03-30 08:26:10] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:10] INFO [#4] Created new pool resource #4
[2020-03-30 08:26:10] DEBUG [#4] Assigned message <cbd3bc3b-4b8e-dea1-876a-59f7a8b76889@gmail.com> to #4 (1)
[2020-03-30 08:26:10] DEBUG [lNOaT7mPh24] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:10] INFO [lNOaT7mPh24] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:11] DEBUG [lNOaT7mPh24] SMTP handshake finished
[2020-03-30 08:26:11] INFO [lNOaT7mPh24] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:11] INFO [#4] Sending message <cbd3bc3b-4b8e-dea1-876a-59f7a8b76889@gmail.com> using #4 to <argentumonline@riseup.net>
[2020-03-30 08:26:12] INFO [lNOaT7mPh24] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: JOAQUINBACA7@GMAIL.COM
Se esta enviando un email de newsletter a: ASIER_OH@HOTMAIL.COM
[2020-03-30 08:26:13] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:13] INFO [#5] Created new pool resource #5
[2020-03-30 08:26:13] DEBUG [#5] Assigned message <9e2696f6-dbc3-860b-0c39-8e66ba8390aa@gmail.com> to #5 (1)
[2020-03-30 08:26:13] DEBUG [2o8gi37T4lw] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:14] INFO [2o8gi37T4lw] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:14] DEBUG [2o8gi37T4lw] SMTP handshake finished
[2020-03-30 08:26:15] INFO [2o8gi37T4lw] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:15] INFO [#5] Sending message <9e2696f6-dbc3-860b-0c39-8e66ba8390aa@gmail.com> using #5 to <argentumonline@riseup.net>
[2020-03-30 08:26:16] INFO [2o8gi37T4lw] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: ASIER_OH@HOTMAIL.COM
Se esta enviando un email de newsletter a: EJEMPLO@EJEMPLO.COM
[2020-03-30 08:26:17] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
如您所见,这很奇怪,因为不是:
- 遵守 rateDelta 和 rateLimit 参数
- POOL 正在创建一个新连接,即使我们没有达到 100 个连接
https://nodemailer.com/smtp/pooled/
知道我做错了什么吗??
这是一个错误吗?我使用的是最新版本 "nodemailer": "^6.4.6",
rateLimit 和 rateDelta 是已弃用的选项,与它们相关的任何错误都不会得到修复。
我为这样的电子邮件创建了一个池传输:
const nodemailer = require('nodemailer');
let poolNewsletterEmail;
let poolGeneralEmail;
exports.createTransporter= function(callback) {
// create reusable transporter object using the default SMTP transport
poolNewsletterEmail = nodemailer.createTransport({
pool: true,
logger: true,
secure: true, // use SSL
rateDelta: 86400000, //24 Hours
rateLimit: 2,
host: process.env.EMAIL_HOST_NEWSLETTER,
port: process.env.EMAIL_PORT_NEWSLETTER,
auth: {
user: process.env.EMAIL_USER_NEWSLETTER,
pass: process.env.EMAIL_PASSWORD_NEWSLETTER,
},
});
callback()
};
exports.getNewsletterPool = function() {
return poolNewsletterEmail;
};
我是这样吃的:
const info = await emailTransporter.getNewsletterPool().sendMail(mailOptions).catch(console.error);
这是日志
$ npm start
> ao-api-server@1.0.0 start C:\ao-api-server
> node index.js
[2020-03-30 08:25:39] DEBUG Creating transport: nodemailer (6.4.6; +https://nodemailer.com/; SMTP (pool)/6.4.6[client:6.4.6])
[2020-03-30 08:25:39] DEBUG Creating transport: nodemailer (6.4.6; +https://nodemailer.com/; SMTP (pool)/6.4.6[client:6.4.6])
Transportador de email general creado con exito para el email: argentumonline@riseup.net
Transportador de email newsletter creado con exito para el email: aolibre@gmail.com
Conexion a la BD MySQL Exitosa!K[0m
Argentum Online API on Port:- 1337 Started at :- Mon Mar 30 2020 21:25:39 GMT+1300 (New Zealand Daylight Time)
Logged in Discord as AO Libre BOT#6711!
sendNewsletterEmail: El subject asdasdasdasdasd
Hay que enviar 1905 emails
Se esta enviando un email de newsletter a: HEN.H2O@LIVE.COM.AR
[2020-03-30 08:25:57] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:25:57] INFO [#1] Created new pool resource #1
[2020-03-30 08:25:57] DEBUG [#1] Assigned message <e8bc3a91-1131-c41a-7e9f-f887a9f7b217@gmail.com> to #1 (1)
[2020-03-30 08:25:57] DEBUG [8YiRWBx0hR4] Resolved smtp.gmail.com as 74.125.130.108 [cache miss]
[2020-03-30 08:25:58] INFO [8YiRWBx0hR4] Secure connection established to 74.125.130.108:465
[2020-03-30 08:25:58] DEBUG [8YiRWBx0hR4] SMTP handshake finished
[2020-03-30 08:25:58] INFO [8YiRWBx0hR4] User "aolibre@gmail.com" authenticated
[2020-03-30 08:25:58] INFO [#1] Sending message <e8bc3a91-1131-c41a-7e9f-f887a9f7b217@gmail.com> using #1 to <argentumonline@riseup.net>
[2020-03-30 08:26:00] INFO [8YiRWBx0hR4] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: HEN.H2O@LIVE.COM.AR
Se esta enviando un email de newsletter a: M@M.COM
[2020-03-30 08:26:01] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:01] DEBUG [#1] Connection #1 became available
[2020-03-30 08:26:01] DEBUG [#1] Assigned message <65afa327-b754-81e5-361d-243d29673b1a@gmail.com> to #1 (2)
[2020-03-30 08:26:01] INFO [#1] Sending message <65afa327-b754-81e5-361d-243d29673b1a@gmail.com> using #1 to <argentumonline@riseup.net>
[2020-03-30 08:26:02] INFO [8YiRWBx0hR4] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: M@M.COM
Se esta enviando un email de newsletter a: SHAI_05@HOTMAIL.COM
[2020-03-30 08:26:03] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:03] INFO [#2] Created new pool resource #2
[2020-03-30 08:26:03] DEBUG [#2] Assigned message <b465d175-8518-f64c-4f92-3a6cd2d19d5a@gmail.com> to #2 (1)
[2020-03-30 08:26:03] DEBUG [k1JVRGXrL00] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:03] INFO [k1JVRGXrL00] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:04] DEBUG [k1JVRGXrL00] SMTP handshake finished
[2020-03-30 08:26:04] INFO [k1JVRGXrL00] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:04] INFO [#2] Sending message <b465d175-8518-f64c-4f92-3a6cd2d19d5a@gmail.com> using #2 to <argentumonline@riseup.net>
[2020-03-30 08:26:05] INFO [k1JVRGXrL00] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: SHAI_05@HOTMAIL.COM
Se esta enviando un email de newsletter a: NADIE@GMAIL.COM
[2020-03-30 08:26:07] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:07] INFO [#3] Created new pool resource #3
[2020-03-30 08:26:07] DEBUG [#3] Assigned message <f2137568-1317-4927-db2a-717e52681e32@gmail.com> to #3 (1)
[2020-03-30 08:26:07] DEBUG [XCYpzqbxy50] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:07] INFO [XCYpzqbxy50] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:07] DEBUG [XCYpzqbxy50] SMTP handshake finished
[2020-03-30 08:26:08] INFO [XCYpzqbxy50] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:08] INFO [#3] Sending message <f2137568-1317-4927-db2a-717e52681e32@gmail.com> using #3 to <argentumonline@riseup.net>
[2020-03-30 08:26:09] INFO [XCYpzqbxy50] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: NADIE@GMAIL.COM
Se esta enviando un email de newsletter a: JOAQUINBACA7@GMAIL.COM
[2020-03-30 08:26:10] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:10] INFO [#4] Created new pool resource #4
[2020-03-30 08:26:10] DEBUG [#4] Assigned message <cbd3bc3b-4b8e-dea1-876a-59f7a8b76889@gmail.com> to #4 (1)
[2020-03-30 08:26:10] DEBUG [lNOaT7mPh24] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:10] INFO [lNOaT7mPh24] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:11] DEBUG [lNOaT7mPh24] SMTP handshake finished
[2020-03-30 08:26:11] INFO [lNOaT7mPh24] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:11] INFO [#4] Sending message <cbd3bc3b-4b8e-dea1-876a-59f7a8b76889@gmail.com> using #4 to <argentumonline@riseup.net>
[2020-03-30 08:26:12] INFO [lNOaT7mPh24] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: JOAQUINBACA7@GMAIL.COM
Se esta enviando un email de newsletter a: ASIER_OH@HOTMAIL.COM
[2020-03-30 08:26:13] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
[2020-03-30 08:26:13] INFO [#5] Created new pool resource #5
[2020-03-30 08:26:13] DEBUG [#5] Assigned message <9e2696f6-dbc3-860b-0c39-8e66ba8390aa@gmail.com> to #5 (1)
[2020-03-30 08:26:13] DEBUG [2o8gi37T4lw] Resolved smtp.gmail.com as 74.125.130.108 [cache hit]
[2020-03-30 08:26:14] INFO [2o8gi37T4lw] Secure connection established to 74.125.130.108:465
[2020-03-30 08:26:14] DEBUG [2o8gi37T4lw] SMTP handshake finished
[2020-03-30 08:26:15] INFO [2o8gi37T4lw] User "aolibre@gmail.com" authenticated
[2020-03-30 08:26:15] INFO [#5] Sending message <9e2696f6-dbc3-860b-0c39-8e66ba8390aa@gmail.com> using #5 to <argentumonline@riseup.net>
[2020-03-30 08:26:16] INFO [2o8gi37T4lw] <45975 bytes encoded mime message (source size 45972 bytes)>
Se envio un email de newsletter a: ASIER_OH@HOTMAIL.COM
Se esta enviando un email de newsletter a: EJEMPLO@EJEMPLO.COM
[2020-03-30 08:26:17] DEBUG Sending mail using SMTP (pool)/6.4.6[client:6.4.6]
如您所见,这很奇怪,因为不是:
- 遵守 rateDelta 和 rateLimit 参数
- POOL 正在创建一个新连接,即使我们没有达到 100 个连接
https://nodemailer.com/smtp/pooled/
知道我做错了什么吗?? 这是一个错误吗?我使用的是最新版本 "nodemailer": "^6.4.6",
rateLimit 和 rateDelta 是已弃用的选项,与它们相关的任何错误都不会得到修复。