function to send email with attachment