This feature is already implemented in epesi.
You need to setup e-mail account: Menu -> My Settings -> Control Panel -> e-mail accounts
The mail server has to support IMAP protocol - most servers do.
Once setup you will go to e-mail client (which is Roundcube) and you can archive the message automatically clicking on the Archive button:

epesi will scan for the sender's e-mail address. It then extracts the e-mail text and attachments and stores it as an object in epesi. A link is placed under your Contact record as well as the Sender's.
On the e-mail client side - the message is not deleted but moved to Epesi Archive folder.
When clicking on Archive button once and the sender's e-mail address is not in the database you will get an error that it could not be archived. If you click on it the second time it will force to archive the message but the link will be placed only under your contact Mails Add-On (Tab):

Note the first arrow - it allows you to copy the link and then you can go to any other record like Meeting, Task - and paste this link to the e-mail message there. Becasue this is a true single instance of the e-mail message it is not copied but just a reference link is stored in the database.
Note also the second arrow - Mail Addresses. Here you can associate contact with multiple e-mail addresses - this is used when epesi is searching the database when creating the link. If you have several contacts with the same e-mail address it will link it to the first one found.