A script that ran happily for about a year suddenly stopped working last week. From the stack trace, it was apparent that the script was stumbling on Python's smtplib>sendmail command. Here's the error:
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
The offending code: