However I'm trying to get a sense of the big picture. Basically it needs two pieces of code:
1. code to add an email to the queue (where the queue is database table)
2. code to periodically pull the emails from the queue and send them.

part two I'm thinking of even writing with a python script and crontab. But since I want to learn the Yii way I'm curious how to do it.

However what Yii constructs (console apps, components, extensions) should I use for each part? It needs to be accessible to multiple applications. Would it be better to make an extension that is installed in each yii app? Or to have a single app that handles emailing from multiple apps?

I used a console app that basically collects all mail queues that haven't been sent (success = 0 && attempts < 5 - don't want it to hang on a malformed message) and uses Yii Mail to send the message. Yii Mail has the ability to use views to generate email body. This is handy and allows me to have multiple templates that can be reused such as a registration email template etc.

Rendering views in a console app can be tricky although it's possible - for this reason, I generate the message body in my web app controllers and save the entire HTML message into tbl_mail_queue - for example, when a user completes their registration, I generate a new MailQueue with the appropriate message, save it, and I'm done. The console app takes care of the rest.

As for multiple apps using it, there shouldn't be any trouble - it is generic and the tbl_mail_queue should hold all the necessary info including message body and success flags.

I'm travelling at the moment but I can post my code when I back on Monday.

Thank you that's exactly the type of structure I was looking for. If you wanted to make this functionality available to multiple applications, how would you go about doing that? Copy and paste it into each app? Create an extension? Create a single console app that other apps somehow reference?

Sure there are a few other solutions (e.g. infinite loop scripts, threads) but I would not recommend them cause cronjobs are very easy to set up.

If you are not allowed to create cronjobs by your provider you can run the script on one/or several user action on your site combined with a time limitation e.g. the last script run have to be at least 5 minutes ago. Keep in mind if no user "triggers" your script no emails are sent.

In the case of your mail queue I would think about sending the mails if the queue has at least xx entries. Check this after every insert to the mail queue.