check len(links) before sending mails