From 3ba512849f7b0ed184f2c06b481a7838ecdbe1e2 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 10 Oct 2015 11:29:02 +0200 Subject: Do not send an email if there is no birthday --- src/Main.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index 9b5541c..29e9698 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -46,8 +46,12 @@ main = do (Right birthdates, Right config) -> do currentDate <- getCurrentDate let birthdays = filterBirthday currentDate birthdates - sendMail - (mailTo config) - (mailFrom config) - (mailSubject birthdays) - (mailBody currentDate birthdays) + if not (null birthdays) + then + sendMail + (mailTo config) + (mailFrom config) + (mailSubject birthdays) + (mailBody currentDate birthdays) + else + return () -- cgit v1.2.3