Skip to content

Instantly share code, notes, and snippets.

@jeb2239
Created September 12, 2016 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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="from@example.com",
toaddrs="to@example.com",
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