System Information
**Strapi Version4 :
**Operating Systemwindows :
**Databasepostgres :
**Node Versionlast :
NPM Version :
Yarn Version :
I am using strapi v4 and I want when the user register he receives an email verification
after i Enable email confirmation the registration form doesn’t work
Try inside the src/index.js
inside bootstrap
bootstrap({ strapi }) {
strapi.db.lifecycles.subscribe({
models: ["plugin::users-permissions.user"],
// Send email to new user
async afterCreate({ params }) {
const {
data: { email, username },
} = params;
try{
await strapi.plugins['email'].services.email.send({
to: `${email}`,
from: `${process.env.SENDGRID_DEFAULT_FROM}`,
replyTo: `${process.env.SENDGRID_DEFAULT_TO}`,
cc: 'valid email address',
bcc: 'valid email address',
replyTo: 'valid email address',
subject: `${username}, Welcome to the ....`,
html: `<p>${username}</p><p>Welcome to ....</p>
<p>${process.env.CLIENT_BASE_URL}/confirm-email</p>`,
})
} catch(err) {
console.log(err);
}
},
});
}
1 Like
Shekhar
December 19, 2022, 2:38pm
3
Hi,
Can you help me out with the same requirement
What I want is when user register in site, this Strapi Api https://www.sitename.com/api/users is executed, they will receive an email for Confirmation with link. When click on link the user will be verified and will be able to login or else the user will be unauthorized.
I am talking about Content Manager - Users (Awesome Screenshot )
Thanks