Note: If you are an EMS server admin and wish to export your entire EMS server, please see Migrate From EMS to Self-Hosted.
Using your Element client you can export your Room's message history in HTML, Plain Text or JSON format - including attachments.
Open the room you wish to export message history
Access 'Room Info' using the icon in the top right
Select 'Export Chat', then confirm your desired settings for export
Finally click 'Export' - once the export has completed you will be prompted to save an archive of the export.