I want to show you how to connect to Yahoo! Mail account via SMTP and send an email to the same account. If you can send an email from and to the same account, you can use it to send any addresses.
Anyways, the same functionality can be used on a Google mail account. In fact, I got it working with a Google mail account before I changed the hard code account info to a Yahoo! Mail account. The reason I did that is security. With Google account, I had to go to my security configuration page to turn on the setting allowing 3rd party application to access my Google mail account. It was a simple switch that you can flip on and off. To me, this was not secure enough.
Yahoo! Mail, on the other hand, uses a more secure way to allow my application to access my own mail account. Then I can get to my security configuration, enable my mail to allow 3rd party application to access. Here comes a twist, instead of a switch where I can turn on/off the mail access, I had to create a separated passcode for the 3rd party application. It is different from Google Mail, which means my primary password does not need to be exposed.