From aa094254246c3a384d2f0d37b54d4f571289bade Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Mon, 7 Jul 2025 18:55:36 +0300 Subject: [PATCH] check if any connection first --- mastodon_email_bridge/mastodon_email_bridge.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mastodon_email_bridge/mastodon_email_bridge.py b/mastodon_email_bridge/mastodon_email_bridge.py index 6567dca..221abd0 100755 --- a/mastodon_email_bridge/mastodon_email_bridge.py +++ b/mastodon_email_bridge/mastodon_email_bridge.py @@ -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')