Add lots of log messages

This commit is contained in:
Piotr F. Mieszkowski 2023-04-08 19:24:29 +02:00
parent 8a42f3fea1
commit 1f1fe1dadb
1 changed files with 8 additions and 0 deletions

View File

@ -578,9 +578,13 @@ def send_msg(message: str, recipients, fromaddr=None):
if recipients:
LOG.info(f"Sending email to: {recipients!r}")
relay = conf.relay_params()
LOG.debug('Got relay parameters: %s', relay)
smtp = smtplib.SMTP(relay[0], relay[1])
LOG.debug('have session')
if conf.flag_enabled('relay', 'starttls'):
LOG.debug('Issuing STARTTLS')
smtp.starttls()
LOG.debug('sending')
smtp.sendmail(from_addr, recipients, message)
else:
LOG.info("No recipient found")
@ -597,9 +601,13 @@ def send_msg_bytes(message: bytes, recipients, fromaddr=None):
if recipients:
LOG.info(f"Sending email to: {recipients!r}")
relay = conf.relay_params()
LOG.debug('Got relay parameters: %s', relay)
smtp = smtplib.SMTP(relay[0], relay[1])
LOG.debug('have session')
if conf.flag_enabled('relay', 'starttls'):
LOG.debug('Issuing STARTTLS')
smtp.starttls()
LOG.debug('sending')
smtp.sendmail(from_addr, recipients, message)
else:
LOG.info("No recipient found")