check if any connection first

This commit is contained in:
Antonio J. Delgado 2025-07-07 18:55:36 +03:00
parent 7d7bc5b28e
commit aa09425424

View file

@ -189,8 +189,9 @@ class MastodonEmailBridge:
def send_mail(self, data):
'''Send an email with the post composed'''
if time.time() - self.last_smtp_connection < 1:
time.sleep(1)
if self.last_smtp_connection:
if time.time() - self.last_smtp_connection < 1:
time.sleep(1)
sender = self._str_template(self.config['sender'], data)
recipient = self._str_template(self.config['recipient'], data)
msg = MIMEMultipart('alternative')