X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fsmtp-client-pool%2Fsrc%2Fmain.ts;h=4d1f2ea896188b7cfa49aa559dfaaab5f5a28f7c;hb=8b7aa4204c27efd1dc699f7baea65b5262bd26b3;hp=70b1cb244cbdc7988d9e038533e354061106288b;hpb=9aef1431cbefd8bf1fc48654c94cc464243e0113;p=poolifier.git diff --git a/examples/typescript/smtp-client-pool/src/main.ts b/examples/typescript/smtp-client-pool/src/main.ts index 70b1cb24..4d1f2ea8 100644 --- a/examples/typescript/smtp-client-pool/src/main.ts +++ b/examples/typescript/smtp-client-pool/src/main.ts @@ -1,8 +1,10 @@ +import type SMTPTransport from 'nodemailer/lib/smtp-transport/index.js' + import { smtpClientPool } from './pool.js' const tos = ['bar@example.com, baz@example.com'] -const smtpClientPoolPromises = new Set>() +const smtpClientPoolPromises = new Set>() for (const to of tos) { smtpClientPoolPromises.add( smtpClientPool.execute({ @@ -12,16 +14,16 @@ for (const to of tos) { secure: true, auth: { user: 'REPLACE-WITH-YOUR-ALIAS@DOMAIN.TLD', - pass: 'REPLACE-WITH-YOUR-GENERATED-PASSWORD' - } + pass: 'REPLACE-WITH-YOUR-GENERATED-PASSWORD', + }, }, mail: { from: '"Foo" ', to, subject: 'Hello', text: 'Hello world?', - html: 'Hello world?' - } + html: 'Hello world?', + }, }) ) } @@ -30,9 +32,9 @@ try { await Promise.all(smtpClientPoolPromises) const elapsedTime = performance.now() - now console.info( - `Send in parallel in ${elapsedTime.toFixed(2)}ms ${ - tos.length - } mails with SMTP client pool` + `Send in parallel in ${elapsedTime.toFixed( + 2 + )}ms ${tos.length.toString()} mails with SMTP client pool` ) } catch (error) { console.error(error)