How exactly does it work? I am only getting and URL to invite someone but is it possible to automatically send emails? I have to send grid connected and it works fine for a password reset.
This topic has been created from a Discord post (1288119266297643019) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord
those are for admin users of strapi. is it those you want or you need application users?
Yes i need it for admin users
I’m interested in that too, I also looked for how to do that but so far, I can’t find any guide to do that,
No admin invites do not send emails at all
<@1046361692046630933> use this in your src/index.js
file
‘use strict’;
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 }) {
strapi.db.lifecycles.subscribe({
models: [‘admin::user’],
async afterCreate(event) {
const {
data: { email, firstname, lastname, registrationToken },
} = event.params;
/**
* The third argument here is the list of variables passed to the Lodash
* string template we configured at the top of the file, feel free to customize
* it as you please, but remember that the registrationToken value should
* be appended to the link so that admins can register.
*/
console.log(“Send email”)
console.log(email)
console.log(firstname)
console.log(lastname)
console.log(registrationToken)
// await strapi.plugins.email.services.email.sendTemplatedEmail(
// { to: email },
// registeredAdminTemplate,
// { name: [firstname, lastname].join(’ '), registrationToken }
// );
},
});
},
};
<@795469370775175168> thanks, I’ve tried this approach but I don’t know why it’s not working https://www.youtube.com/watch?v=zuJPTIEYbXk&t=351s&ab_channel=AlextheEntreprenerd