send confirmation email in strapi
async sendConfirmationEmail(user) {
const userPermissionService = strapi.plugins['users-permissions'].services.userspermissions;
const pluginStore = await strapi.store({
environment: '',
type: 'plugin',
name: 'users-permissions',
});
const settings = await pluginStore
.get({ key: 'email' })
.then(storeEmail => storeEmail['email_confirmation'].options);
const userInfo = sanitizeEntity(user, {
model: strapi.query('user', 'users-permissions').model,
});
const confirmationToken = crypto.randomBytes(20).toString('hex');
await this.edit({ id: user.id }, { confirmationToken });