Commit 2f782572 authored by Vincent Pelletier's avatar Vincent Pelletier

admin: Qualify email sender address.

parent f4725366
...@@ -19,6 +19,7 @@ import getpass, os ...@@ -19,6 +19,7 @@ import getpass, os
from collections import Counter from collections import Counter
from email.mime.text import MIMEText from email.mime.text import MIMEText
from email.utils import formataddr, formatdate from email.utils import formataddr, formatdate
from socket import getfqdn
from time import time from time import time
from traceback import format_exc from traceback import format_exc
from neo.lib import logging from neo.lib import logging
...@@ -161,7 +162,7 @@ class Application(BaseApplication, Monitor): ...@@ -161,7 +162,7 @@ class Application(BaseApplication, Monitor):
email_from = os.getenv('EMAIL') email_from = os.getenv('EMAIL')
if not email_from: if not email_from:
try: try:
email_from = getpass.getuser() email_from = '%s@%s' % (getpass.getuser(), getfqdn())
except Exception: except Exception:
email_from = None email_from = None
self.email_from = formataddr(("NEO " + self.name, email_from)) self.email_from = formataddr(("NEO " + self.name, email_from))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment