I am looking for a bit of wisdom.
I have a situation where an external html page will insert into a table in mysql db.
Basically the scenario is similar to registration. User enters info in form, capture in db, send email to verify,
User recieves email, clicks on link to verify, account is set active. User can then login.
I would rather do this as a Yii Form but the external website exists and can’t be updated, there are also some politics involved.
So if the data is inserted into the table.
How do I best trigger the creation of an email to send to the user?
I can build the email in text or html format (would like to use a template), send it and setup a controller to validate the link
and redirect the user to a login. Just can’t sort out the best way to trigger the event.
Options that I have thought of so far:
- A cron job that runs every minute looking at the queue of registrants (1 minute is a big delay but I hate to have cron
kicking off that frequently)
- Try to send the email from the POST when the db record is sent. I can do this but it makes it very difficult to sync with
the email verify as I have to build some sort of hash string, currently done in the db pre-insert trigger.
I found the hash at insert works fine but from the Yii controller the value is null in the after-save (insert) trigger
in the controller…but that is a whole different post.
As always thanks for any help! This is a great communitYii!