Skip to content

Commit

Permalink
timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
SpudGunMan committed Dec 9, 2024
1 parent 8b4409c commit 446fa0c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions modules/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# System variables
trap_list_smtp = ("email:", "setemail:", "sms:", "setsms:", "clearsms:")
smtpThrottle = {}
SMTP_TIMEOUT = 10

if enableImap:
# Import IMAP library
Expand Down Expand Up @@ -44,7 +45,7 @@ def send_email(to_email, message, nodeID=0):
msg.attach(MIMEText(message, 'plain'))

# Connect to SMTP server
server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT, timeout=SMTP_TIMEOUT)
server.starttls()
server.login(SMTP_USERNAME, SMTP_PASSWORD)

Expand All @@ -64,7 +65,7 @@ def check_email(nodeID, sysop=False):

try:
# Connect to IMAP server
mail = imaplib.IMAP4_SSL(IMAP_SERVER)
mail = imaplib.IMAP4_SSL(IMAP_SERVER, IMAP_PORT, timeout=SMTP_TIMEOUT)
mail.login(IMAP_USERNAME, IMAP_PASSWORD)
mail.select(IMAP_FOLDER)

Expand Down

0 comments on commit 446fa0c

Please sign in to comment.