Can't send or receive e-mail via Mail
Mail app has a weird tendency to mix SMTP servers, which may be the cause of your issue.

Open Mail.app, go to Preferences > Accounts and select one of your accounts.
Look for the "Outgoing Mail Server (SMTP):" dropdown; click on it and then on "Edit SMTP server list".
Delete all SMTP servers that don't correspond to the accounts that you're trying to configure (if you have two accounts, you should have two SMTP servers). Select the corresponding SMTP server for each account. Check the box that says "Use only this server".

Check that the settings correspond with what each vendor recommends.

For Google Mail:

"Account Information" tab


Server name: smtp.gmail.com
TLS Certificate: None


"Advanced" tab


Automatically detect and maintain account settings: Checked (not sure if needed)
Port: 587
Use SSL: Checked
Authentication: Password
Allow insecure authentication: Unchecked
User name: your whole email (user@gmail.com)
Password: your password.


Up to date info on how to configure IMAP client for Google: https://support.google.com/mail/answer/7126229

For Yahoo Mail:

"Account Information" tab


Server name: smtp.mail.yahoo.com
TLS Certificate: None


"Advanced" tab


Automatically detect and maintain account settings: Checked (not sure if needed)
Port: 587
Use SSL: Checked
Authentication: Password
Allow insecure authentication: Unchecked
User name: your whole email (user@yahoo.com)
Password: your password.


Up to date info on how to configure IMAP client for Yahoo:
https://help.yahoo.com/kb/SLN4075.html