Many changes

- Add contracts
- Add mailer
- Add initial support for export
- Add settings UI
- Bugfixes