iMac/MBP sync email without iCloud

I have an iMac that I've been using for years with lots of mailboxes. I only use my gmail accounts and don't want to use iCloud. How do I sync all the mail and mailboxes on my iMac with another MBP and keep then synced? In other words if I get new emails and move then to a mailbox on my iMac I want that synchronized with the MBP and vice versa.

Thanks
Wouldn't configuring your Gmail account (IMAP) on both devices do that automatically?
It doesn't. The problem is not new messages, the problem is the messages that are already on my iMac that have been moved to Apple mail folders and Gmail doesn't support folders created in Apple mail.

Original thread: https://forums.imore.com/threads/imac-mbp-sync-email-without-icloud.383441/