chuan
chuan

Reputation: 304

Strapi: how to send confirmation email when user signup?

I want to send emails to signup user and activate it until cerntain actions are done.

I don't know whether this feature is available already, or I need to implement the logic myself. With the default authentication and user models, it looks like quite complicated to modify the logics. how difficult is it to implement such features?

Upvotes: 6

Views: 8033

Answers (3)

atazmin
atazmin

Reputation: 5707

It seems there is an option for this feature. enter image description here

Upvotes: 0

Parakh Goel
Parakh Goel

Reputation: 1

You can add a user model file in extensions/user-permissions/models/user.js with an afterCreate hook:

lifecycles: {
    async afterCreate(data) {
        // SEND EMAIL HERE
    },
}

Upvotes: 0

Aurélien Georget
Aurélien Georget

Reputation: 266

As you said, there is already a default logic for the Users in Strapi. However, the files can be edited and you can custom the behavior.

In your case, you need to go to ./api/user/controllers/User.js file in the create method and add your custom logic for sending an email where the User has been created (see https://github.com/strapi/strapi-generate-users/blob/master/files/api/user/controllers/User.js#L52).

I hope this answer will help you!

PS: I'm one of the authors of Strapi.

Upvotes: 10

Related Questions