On my site a type of user can add new clients and I wanted to automate the activation email, so that when a new user is added then the client will get the activation email. But I'm getting an error that the activation $link is missing any idea how to get that parameter? This is what I have so far.
Craft::$app->elements->on(Elements::EVENT_AFTER_SAVE_ELEMENT, function(ElementEvent $event) {
if ($event->element instanceof \craft\elements\User) {
$user = $event->element;
if($event->isNew) {
Craft::$app
->getMailer()
->composeFromKey('after_activate_user')
->setTo($user)
->send();
}
}
});
Digging through some code I saw that you can pass a link parameter like this:
->composeFromKey('after_activate_user', ['link' => Template::raw($link)])
But not sure where I can retrieve this $link
Any help is appreciated.
Thanks!