{"action":"created","issue":{"url":"https://api.github.com/repos/Yelp/elastalert/issues/221","labels_url":"https://api.github.com/repos/Yelp/elastalert/issues/221/labels{/name}","comments_url":"https://api.github.com/repos/Yelp/elastalert/issues/221/comments","events_url":"https://api.github.com/repos/Yelp/elastalert/issues/221/events","html_url":"https://github.com/Yelp/elastalert/issues/221","id":102424607,"number":221,"title":"Fails to send emails with Office 365","user":{"login":"ThomasdOtreppe","id":7316682,"avatar_url":"https://avatars.githubusercontent.com/u/7316682?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasdOtreppe","html_url":"https://github.com/ThomasdOtreppe","followers_url":"https://api.github.com/users/ThomasdOtreppe/followers","following_url":"https://api.github.com/users/ThomasdOtreppe/following{/other_user}","gists_url":"https://api.github.com/users/ThomasdOtreppe/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasdOtreppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasdOtreppe/subscriptions","organizations_url":"https://api.github.com/users/ThomasdOtreppe/orgs","repos_url":"https://api.github.com/users/ThomasdOtreppe/repos","events_url":"https://api.github.com/users/ThomasdOtreppe/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasdOtreppe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-21T17:15:05Z","updated_at":"2015-08-21T17:23:39Z","closed_at":null,"body":"Actually, there is one bug and one improvement in this ticket.\r\n\r\nSystem info: Ubuntu 14.04 64 bit with current elastalert code from git.\r\n\r\nUsing Office365 to send emails fails with the following exception:\r\n```\r\nERROR:root:Traceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/elastalert-0.0.55-py2.7.egg/elastalert/elastalert.py\", line 825, in alert\r\n    return self.send_alert(matches, rule, alert_time=None)\r\n  File \"/usr/local/lib/python2.7/dist-packages/elastalert-0.0.55-py2.7.egg/elastalert/elastalert.py\", line 898, in send_alert\r\n    alert.alert(matches)\r\n  File \"/usr/local/lib/python2.7/dist-packages/elastalert-0.0.55-py2.7.egg/elastalert/alerts.py\", line 241, in alert\r\n    self.smtp.sendmail(self.from_addr, to_addr, email_msg.as_string())\r\n  File \"/usr/lib/python2.7/smtplib.py\", line 742, in sendmail\r\n    raise SMTPRecipientsRefused(senderrs)\r\nSMTPRecipientsRefused: {'me@office365.com': (553, '5.5.4 <me@office365.com>... Domain name required for sender address ElastAlert')}\r\n\r\nERROR:root:Uncaught exception running rule Test Alert 2: {'me@office365.com': (553, '5.5.4 <me@office365.com>... Domain name required for sender address ElastAlert')}\r\n```\r\nIt would be great if it was displaying an error message instead of a stacktrace.\r\n\r\nI've experience a similar error when creating scripts using sendmail. Scripts that worked fine with GMail failed when using Office365 (we are using postfix to relay to Office365). The reason is that GMail didn't require one and was automatically setting the 'From' field based on the credentials you used.\r\n\r\nOffice365 is different. Even if you're logging in with credentials, you MUST set the 'From' field or it will fail miserably.\r\n\r\nSo, it would be great if we could set the 'from' field in the rules or globally in the configuration file (or both)."},"comment":{"url":"https://api.github.com/repos/Yelp/elastalert/issues/comments/133502900","html_url":"https://github.com/Yelp/elastalert/issues/221#issuecomment-133502900","issue_url":"https://api.github.com/repos/Yelp/elastalert/issues/221","id":133502900,"user":{"login":"ThomasdOtreppe","id":7316682,"avatar_url":"https://avatars.githubusercontent.com/u/7316682?v=3","gravatar_id":"","url":"https://api.github.com/users/ThomasdOtreppe","html_url":"https://github.com/ThomasdOtreppe","followers_url":"https://api.github.com/users/ThomasdOtreppe/followers","following_url":"https://api.github.com/users/ThomasdOtreppe/following{/other_user}","gists_url":"https://api.github.com/users/ThomasdOtreppe/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasdOtreppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasdOtreppe/subscriptions","organizations_url":"https://api.github.com/users/ThomasdOtreppe/orgs","repos_url":"https://api.github.com/users/ThomasdOtreppe/repos","events_url":"https://api.github.com/users/ThomasdOtreppe/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasdOtreppe/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T17:23:39Z","updated_at":"2015-08-21T17:23:39Z","body":"The 'from' issue is fixed but I get a different exception:\r\n```\r\nERROR:root:Traceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/elastalert-0.0.55-py2.7.egg/elastalert/elastalert.py\", line 825, in alert\r\n    return self.send_alert(matches, rule, alert_time=None)\r\n  File \"/usr/local/lib/python2.7/dist-packages/elastalert-0.0.55-py2.7.egg/elastalert/elastalert.py\", line 898, in send_alert\r\n    alert.alert(matches)\r\n  File \"/usr/local/lib/python2.7/dist-packages/elastalert-0.0.55-py2.7.egg/elastalert/alerts.py\", line 241, in alert\r\n    self.smtp.sendmail(self.from_addr, to_addr, email_msg.as_string())\r\n  File \"/usr/lib/python2.7/smtplib.py\", line 745, in sendmail\r\n    self.rset()\r\n  File \"/usr/lib/python2.7/smtplib.py\", line 469, in rset\r\n    return self.docmd(\"rset\")\r\n  File \"/usr/lib/python2.7/smtplib.py\", line 394, in docmd\r\n    return self.getreply()\r\n  File \"/usr/lib/python2.7/smtplib.py\", line 365, in getreply\r\n    + str(e))\r\nSMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] Connection reset by peer\r\n```"}}