Skip to content

Instantly share code, notes, and snippets.

@jeb2239
Created September 12, 2016 00:10
Show Gist options
  • Save jeb2239/8d3dc1caaf029c27fae17fb3a6779e91 to your computer and use it in GitHub Desktop.
Save jeb2239/8d3dc1caaf029c27fae17fb3a6779e91 to your computer and use it in GitHub Desktop.
import logging
import logging.handlers
smtp_handler = logging.handlers.SMTPHandler(mailhost=("smtp.example.com", 25),
fromaddr="[email protected]",
toaddrs="[email protected]",
subject=u"AppName error!")
logger = logging.getLogger()
logger.addHandler(smtp_handler)
try:
break
except Exception as e:
logger.exception('Unhandled Exception')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment