kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

"smtplib.SMTPServerDisconnected: Connection unexpectedly closed" after 80+ emails #142

Closed Rmckinstry closed 3 years ago

Rmckinstry commented 5 years ago

I am using this to send a weekly report to all vendors working with our company to remind them of all purchase orders. The send list typically is 150+. I get this full error around 80-96 emails in).

berkowitze commented 5 years ago

Also getting this error. Using with or login/close doesn't solve the problem.

FilipGrebowski commented 4 years ago

@Rmckinstry Did you manage to find a solution to this? It happened to me also.

Rmckinstry commented 4 years ago

@FilipGrebowski the only way I got around it was hard coding a cool down between each email being sent. It’s been a while but I believe it was a second or so. If that doesn’t work try hard coding a 1-3 min cool down after 60 or so emails have been sent

twomed commented 3 years ago

I was having the same issue with only being able to get 80-90 emails out until I added a sleep(1.5) which allowed me to get the whole batch out

kootenpv commented 3 years ago

Probably to do with gmail rate limiting