rft - add attachments type autodetect. Part of #221

rft - add attachments type autodetect. Part of #221