I have restriction from my company environment to use any other SMTP server
which is why I think I can send 5, not more one time.
I tried playing with maxConnections etc properties increasing values but
did not help.
So now, my approach is to live with number 5. But making it send multiple
times. I split the emails data into batches of 5 and then send and
delay/wait. Still first batch of 5 gets delivered,
at next i get error.
"Too many messages"
"Too many sessions".
So that means here problem is with my connection close etc. So when next
batch starts, it should be new connection. So I try to initiate the
connection (createTransport()) with each batch.
Please let me know if i am completely wrong approach.
On Tuesday, August 7, 2018 at 12:35:22 PM UTC-4, sunshine o wrote:
>
> I have case where I send multiple emails( with different contents and
> subjects), all in array , traversed in a loop to deliver multiple
> receipients.
>
> First I used simple nodemailer and i found more than 5 emails in a row, i
> get errors.
>
> I have input data in a json form where I calculate how many emails and
> what contents will go. So senders list and contents are not static and
> calculated in same code before sending out emails.
>
> so first case,
> 1. Use simple nodemailer. Mail sending part is a promise. Works but not
> more than 5. Each email 's return messages etc can be tracked fine and
> final results can be returned since emails work sequential.
>
> 2. Use nodemailer-smtp-pool to increase number of emails.
> Strange that emails do not work normal. 1 or 2 emails are sent and 3rd
> not. Then if I trigger email code multiple times, within seconds it works
> once or twice with error messages.
> "Mail Command Failed: 421 #4.x.2. too many messages for this session"
>
> Code is:
>
> var smtpPool = require('nodemailer-smtp-pool')
> pooledTr =nodemailer.createTransport( smtpPool{ host: "", secure:false,
> port: 25, maxConnections:25, maxMessaes:50, rateLimit:10...})
>
> then in a loop for all the emails,
> pooledTr.sendMail(mOptions , (err, callback)=>{....})
>
> Now, we do not have promise anymore, as we do not want to wait till first
> email send and returns.
>
> Can any one help if I need to use events in pooledtransported, like wait
> till connection is idle to send. Also If I need to add time wait or promise
> till it delivers?
>
> I googled but do not what examples per my scenario.
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/119a2265-c244-4cc7-86ef-f56de0512634%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.