A complete script that sends emails with attachments using the Web API