From 4963ca78b8be17ae242d1aed6b47a5a66f47d441 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 1 May 2017 11:49:05 -0400 Subject: avoid sending email when it's clearly not a valid email address --- Server.hs | 7 +++++-- 1 file 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 -- cgit v1.2.3