changed mail.js scheduling error handling for readability and clarity