Merge pull request #488 from roji/email_attachment_fixes