rft - add attachments type autodetect. Part of #221