See OS X Mail: Troubleshooting sending and receiving email messages for details. on troubleshooting mail.
Your SMTP server settings are incorrect. Mail has two connections, a receive path from your mail server to your mail client, and a send path from your mail client to the mail server. The send path uses SMTP to communicate with the server.
Apple Mail.app has separate settings for the receive and send paths; each has its own server, username, password, port and SSL settings. Your send path settings are likely incorrect.
To determine the proper settings, check with Yahoo for the SMTP server settings for your account (usually a web search, but I don't know the details of how Yahoo sets up their accounts by default nor whether that varies by account), and verify that your settings match — the send-path settings are available via the accounts settings; Mail > Preferences > Accounts > select the account > Account Information > and switch the Select SMTP Server setting to Edit SMTP Server List... > select your Yahoo SMTP server, and set the account details per Yahoo requirements.