extract and store attachments, refs #247