That error is very generic and essentially useless, because any authentication failure will result in the same "name or password incorrect" message, even if you are 100% certain those credentials are correct.
Please read If you can’t send or receive email on your Mac - Apple Support. This might also help: Mail Settings Lookup - Apple Support.
Here are some additional troubleshooting steps to follow.
- Temporarily stop using an email account: (Apple menu) > System Preferences... > Internet Accounts > select your email service, and de-select Mail. Wait a moment or two, then select it again. Repeat for each email account you use, testing after each one.
- If all else fails, temporarily remove that Mail Account from that System Preferences pane, and then add it again.
The last two suggestions are described in greater detail here: Set up Mail with email accounts - Apple Support.