Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

340
Vistas
I am new to Strapi version 4, I want to confirm my email using the following code

'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

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda