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

222
Vistas
Insert text into HTML/CSS e-mail with function from a different file

I have a html/css e-mail template that I want to use to send users e-mails for things like welcoming after signing up, send secret codes, and general purpose e-mails.

I need to "inject" this html template it with custom text instead of the lorem ipsum it currently contains.

I want to make a javascript function that inserts given text into my html template, this way my e-mail service can send custom e-mail to users based on their e-mail and custom messages throughout my node app as certain events are triggered.

I have a html/css e-mail in the file generalContact.html

I am unsure of 1 how "export" it so that makeEmail.js has access to the template and 2 how to format the html email so it can accept custom input text.

Do I have to assign the template to a variable first somehow?

Any help/guidance would be appreciated, thank you.

makeEmail.js

const htmlTemplate = require("generalContact.html")

const makeEmail = (bodyText) => {
      // How can I access the HTML file and insert the above input into it?
      return emailWithTextInserted 
}

module.exports = makeEmail

generalContact.html

<!DOCTYPE html PUBLIC "-//W3C/...." "http://www.w3.org/.....">
<html xmlns="http://www.w3.org......">
  <head>
    <title></title>
  </head>
  <body>
    <center>
      <tr>
        <td>
          This is Photoshop's version of Lorem Ipsum. Proin gravida nibh vel
          velit auctor aliquet. Aenean sollicitudin, lorem quis bibendum auctor,
          nisi elit consequat ipsum, nec sagittis sem nibh id elit. Duis
          <a>
          sit amet nibh vulputate cursus a sit amet mauris.<br /><br />

          Mauris in erat justo. Nullam ac urna eu felis dapibus condimentum sit
          amet a augue. Sed non neque elit. Sed ut imperdiet nisi. Proin
          condimentum fermentum nunc. Etiam
          <a>
          erat sed fermentum feugiat, velit mauris egestas quam, ut aliquam
          massa nisl quis neque. Suspendisse in orci enim.
        </td>
      </tr>
    </center>
  </body>
</html>
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