Retry sendmail fails on 421 error code
Here is the traceback:
1 139976116270784 [2024-11-05 08:31:30,068] CRITICAL trytond.transaction A datamanager raised an exception in tpc_finish, the data might be inconsistant
Traceback (most recent call last):
File "/tryton/trytond/trytond/sendmail.py", line 61, in send_message
senderrs = server.send_message(msg, from_addr, to_addrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/smtplib.py", line 986, in send_message
return self.sendmail(from_addr, to_addrs, flatmsg, mail_options,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/smtplib.py", line 887, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
smtplib.SMTPSenderRefused: (421, b'Connection closed by server. Maximum message count per session reached.', '<no-reply@nan-tic.com>')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tryton/trytond/trytond/transaction.py", line 345, in commit
datamanager.tpc_finish(self)
File "/tryton/trytond/trytond/sendmail.py", line 170, in tpc_finish
new_server = send_message(
^^^^^^^^^^^^^
File "/tryton/trytond/trytond/sendmail.py", line 72, in send_message
server.quit()
File "/usr/lib/python3.11/smtplib.py", line 1004, in quit
res = self.docmd("quit")
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/smtplib.py", line 431, in docmd
self.putcmd(cmd, args)
File "/usr/lib/python3.11/smtplib.py", line 378, in putcmd
self.send(f'{s}{CRLF}')
File "/usr/lib/python3.11/smtplib.py", line 365, in send
raise SMTPServerDisconnected('please run connect() first')
smtplib.SMTPServerDisconnected: please run connect() first