updated version of main.js that runs attachments on sendgrid hopefully