Modified emails.js script