You must use this
Go to src/index.js
"use strict";
const { newRegister } = require("../utils/sendMail");
module.exports = {
/**
* An asynchronous register function that runs before
* your application is initialized.
*
* This gives you an opportunity to extend code.
*/
register(/*{ strapi }*/) {},
/**
* An asynchronous bootstrap function that runs before
* your application gets started.
*
* This gives you an opportunity to set up your data model,
* run jobs, or perform some special logic.
*/
// bootstrap(/*{ strapi }*/) {},
async bootstrap({ strapi }) {
strapi.db.lifecycles.subscribe({
models: ["plugin::users-permissions.user"],
async afterCreate(event) {
// your code here
});
},
};