Check if email exist in DB

Hello I need some help , My login is with email only instead of username , and when I click on forgotten password "link" and type some email address to check if that email address exist in the DB,and if exist to send email to that email address . I make the forgotten form ,but dont know how to make the rest ,because I`m a bit new in Yii2 Basic

my DB is with fields id(AI),email,password,firstname,secondname (if someone need this)

Thank you in advance!

If you post some code would be easier to give you an answer ;)

The advanced project template already has a feature that you are trying to make.

Look at the code of @frontend\controllers\SiteController.php and its corresponding models and views, then you’ll get some hints.