summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-05-01 11:49:05 -0400
committerJoey Hess <joeyh@joeyh.name>2017-05-01 11:49:05 -0400
commit4963ca78b8be17ae242d1aed6b47a5a66f47d441 (patch)
treeca64b6ba249bdcafcd03975b6ce8f602845430f9
parent07ef4ae17082f8e04959ef707ce6d279c8823bda (diff)
downloaddebug-me-4963ca78b8be17ae242d1aed6b47a5a66f47d441.tar.gz
avoid sending email when it's clearly not a valid email address
-rw-r--r--Server.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Server.hs b/Server.hs
index 136aefa..d7a43a0 100644
--- a/Server.hs
+++ b/Server.hs
@@ -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