Fixed errors in send_daily_email and started writing tests