Skip to content

Instantly share code, notes, and snippets.

@docapotamus
Last active November 18, 2015 13:00
Show Gist options
  • Save docapotamus/21987a2137c42688ad6d to your computer and use it in GitHub Desktop.
Save docapotamus/21987a2137c42688ad6d to your computer and use it in GitHub Desktop.
if not app.debug: # pragma: no cover
import logging
from logging.handlers import SMTPHandler
mail_handler = SMTPHandler(
('smtp.mailgun.org', 25),
'noreply@example.com',
['joe@example.com'],
'Application Error',
(USERNAME, PASSWORD)
)
mail_handler.setLevel(logging.INFO)
app.logger.addHandler(mail_handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment