I think there are at least three different issues addressed in this thread that may appear to have similar symptoms, but are not necessarily fully related. If you're having a problem, you are likely only having one of the issues, although you could possibly be encountering several or all of them, but each would need to be addressed and solved independently.
1) You can get email in Apple Mail, but can't send email.
This is the simplest problem to diagnose and solve. If Apple Mail keeps asking you for a password to send email, but you are able to receive emails in Apple Mail, likely your settings to send emails are not correct. Some of the replies above refer to this issue and how to solve it. Likely you just need to make sure your username, password and server settings for Apple Mail > Settings > Accounts > Outgoing Mail Server (SMTP) are correct. For example, if your account is with google, your username is likely a full email address like "name@domain.com" not just "name". If you don't know what server setting to use, your email provider (eg, google, yahoo, etc) should have help pages helping you know the right settings.
2) You can't get or send email in Apple Mail
Often experienced by Apple Mail continually asking you for a password to even get mail. This issue is most likely to be one of the other two major issues described in this thread:
2.1) You are using "two-factor authentication" with google or another email provider
You should already know if you are using two-factor authentication, because if you are, you will be in the habit of entering your password and a special code sent via text to your phone every time you log in to your email using a web browser. You can confirm if you are using two-factor authentication by logging in to your google (or other provider) account in a web browser and visiting the security settings of your account. There is a setting that will show if two-factor authentication is on or disabled. In this case, review the replies in this thread that have to do with two-factor authentication and make sure you use google or your other email provider to issue a special device password for whatever computer you are using and you are using that device password in Apple Mail rather than your normal password. You will likely need to use that special device password for that specific computer in the Apple Mail settings to both receive and send email (ie, enter it in two different places for the account). That all sounds like a hassle and it is, but if you do get it set up, it is more secure as no one would be able to log in to your email unless they had access to your computer or knew your password and had your phone.
2.2) Your Mac keychain is corrupted or incorrect
In this case, your local Mac storehouse of usernames and passwords is corrupted/incorrect for some reason and you should follow the advice of the replies in this thread that have to do with that. It just means the local copy of your username and password is incorrect and needs to be deleted and replaced with the correct, uncorrupted information.