OK, if the password is stored via the application "keychain", located in the Utilities folder within the Applications folder, you should be able to get it, assuming you know what your user name and password are for your machine (that is the one you used when you set up the OS). Here are the steps:
1. Using Spotlight, type in keychain.
2. Find the name of the mail account and double click or tap on the appropriate entry.
3. The very bottom of the entry will have a box that reads "show password", click on that box. You will then have to authenticate using the computer account credentials (the user name and password you use to log in to that account on the computer)
4. Once authenticated the computer will show you the password needed.
Now, even after doing that, and entering the password when requested, it might continue to happen. So, to fix the issue permanently, follow the information in this link:
http://osxdaily.com/2014/08/10/mac-mail-asks-enter-password-account-fix/