diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-05-01 11:49:05 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-05-01 11:49:05 -0400 |
commit | 4963ca78b8be17ae242d1aed6b47a5a66f47d441 (patch) | |
tree | ca64b6ba249bdcafcd03975b6ce8f602845430f9 | |
parent | 07ef4ae17082f8e04959ef707ce6d279c8823bda (diff) | |
download | debug-me-4963ca78b8be17ae242d1aed6b47a5a66f47d441.tar.gz |
avoid sending email when it's clearly not a valid email address
-rw-r--r-- | Server.hs | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -256,10 +256,13 @@ doneSessionLog email o sid = do else return () emailSessionLog :: EmailAddress -> ServerOpts -> FilePath -> IO () -emailSessionLog email o logfile = renderSendMail - =<< simpleMail to from subject body body [("text/plain", logfile)] +emailSessionLog email o logfile + | isemail = renderSendMail + =<< simpleMail to from subject body body [("text/plain", logfile)] + | otherwise = return () where to = Address Nothing email from = Address Nothing $ fromMaybe "unknown@server" (serverEmail o) subject = "Your recent debug-me session" body = "Attached is the log from your recent debug-me session." + isemail = "@" `T.isInfixOf` email |