Open jrkt opened 8 years ago
Any help here?
started getting the same error, not sure why. Have you solved this by any chance?
I did at least for the problem I was having. The smtp provider, Dyn, had a limit on how many emails could go out in a minute and a limit on how many concurrent workers I had processing the emails with an open connection to the smtp server. So, once I made sure I wasn't sending too many and I had the open connections limited, it fixed the issue.
I have 50 worker goroutines that start with a channel passed in. Then, the process forever loops reading 100 database records at a time and sleeping for 10 seconds in between database calls. As it loops through the 100 email records to send, it passes each record through the channel to one of the 50 workers, who then sends the email. The problem is, after it goes through about 1000 emails, I start getting errors like this:
gomail: could not send email 1: read tcp 10.2.30.25:56708->216.146.40.110:25: read: connection reset by peer
I have to send out about 50k emails per day. What do you recommend? Here's the main code that processes the email queue and passes each record to the worker through the channel: