Q:

What is the best approach to have cronjobs sending periodical emails in basic template of Yii2?

I have a Web Application using Yii2 and I want to have a cronjob sending periodical emails like digests and such.
What is a good approach to implement that using YiiFramework 2.0 e-mail structure.
Edit1: It is important to say that I am using the basic template and not the advanced one

A:

Use the console component of Yii2. Here is a decent intro for using the console
You set up your function as you would if it were on the web application. Build and generate your email and then set a bash script to run on a cron, which calls your function and generates and sends the email. You can log errors and success of the script also. I send them to my email.
Set up you confiruation for DB and anything else using config/console.php that's important. 
Your controllers are in commands folder.
Take a look at https://github.com/yiisoft/yii2-app-basic/blob/master/commands/HelloController.php
Call this file through the console and it will return the message param.
When you build your function to send emails, get it to send you an email with success/failure. I always build my controllers in the application first to check that they work, then migrate them into the commands. 
More help on the console is here

