Fixes for sending email with attachments