Preview:
try:
    server = smtplib.SMTP(settings.email.smtp_server, settings.email.port)
    server.ehlo() # Can be omitted
    server.starttls(context=context) # Secure the connection
    server.ehlo() # Can be omitted
    server.login(settings.email.sender_email, settings.email_password)
    server.sendmail(settings.email.sender_email, receiver, message.format(number=transactions_processed, code=user_identifier))
    logger.info("Email sent to {name}", name=user)
except Exception as e:
    logger.error(e)
finally:
    server.quit()
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter