Works with gmail, too - assuming you've jumped through the necessary hoops to enable full read-write IMAP access to your account.
Edit: Hoops are:
- Gmail Settings > Enable IMAP
- Gmail Settings > Auto-Expunge: off
- Gmail Settings > When a message is marked as deleted and expunged from the last visible IMAP folder: Immediately delete the message forever
- Gmail Settings > Folder size limits: Do not limit
- Account Settings > Secutiry > Signing in > App password > (create one)