'use strict';
/**
* A set of functions called "actions" for `email`
*/
module.exports = {
async index(ctx, next){
const body = ctx.request.body
const sendTo = body.email
const username=body.username
//strapi.log.debug(`Trying to send an email to ${sendTo}`)
try {
const emailOptions = {
to: sendTo,
subject: `Welcome ${username}`,
html: `<h1>Welcome ${username}!</h1>
<p>Thank you for registering!</p>
<p>You have to confirm your email address. Please click on the link below.</p>
<p><%= URL %>?confirmation=<%= CODE %></p>
</p>`,
}
await strapi.plugins['email'].services.email.send(emailOptions)
strapi.log.debug(`Email sent to ${sendTo}`)
ctx.send({ message: 'Email sent' })
} catch (err) {
strapi.log.error(`Error sending email to ${sendTo}`, err)
ctx.send({ error: 'Error sending email' })
}
}
};
I donot know from where this URL AND CODE I will get so that user confirmation changed from false to true at the backend and he will be able to login