How can I fix the email inboxes on my iMac?

When i use my iMac to get my email, the email doesn't go into the right account.
1. I have 5 email accounts (iCloud, Yahoo1, Yahoo2, Outlook and Gmail).
2. New gmail goes into mailbox inbox iCloud (this is wrong)
3. New outlook mail goes into outlook junk (this is wrong)
4. New yahoo1 mail goes into mailbox inbox junk (this is wrong)
5. New iCloud mail goes into mailbox iCloud (this is right)
6. New yahoo2 mail goes into yahoo2 mailbox inbox (this is right)

When i use my mac pro, iPhone or iPad all of the emails goes into their right accounts and boxes
Maybe try removing your email accounts from your iMac and then adding them again?
Removed all email accounts from iMac and I reinstalled them. Gmail dose not show in mailbox. When I try to re-add it, it says that it's already installed on computer. The other email account show up in mailbox.
I have no clue. But maybe someone will come along who knows more than I.
Make sure the description of those inboxes match the email account.

In iOS you can give a description for every account there is. I'm sure MacOS has this too.

If this is not the case, then I don't have any idea on how to fix it.
Removed all email accounts from iMac and I reinstalled them. Gmail dose not show in mailbox. When I try to re-add it, it says that it's already installed on computer. The other email account show up in mailbox.

Go to Mail > Accounts. From the window that displays you should see your email accounts on the left side. Verify Gmail is showing on the side and that "Mail" is enabled.

Also go to Mail > Preferences. Do the same in the window that displays. On the "Accounts" tab to the right of the "General" tab, you should see a display of all your accounts. Select the Gmail account and verify the "Enable this account" option is checked.

Then, in the "Accounts" tab, you notice several sub tabs. "Account Information", "MailBox Behaviors" and "Server Settings". Select "Mailbox Behaviors". Verify those settings are correct as well.
Removed all email accounts from iMac and I reinstalled them again and the email is working better. Still some mail are going to their own email junk mail account. Will look more into setting to correct mail going to junk email account. Thanks for your help.

Original thread: https://forums.imore.com/threads/how-can-i-fix-the-email-inboxes-on-my-imac.386113/