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

305
Vistas
Emojis and Special Characters not rendering on Subject Header in Pug using Sendgrid

Please the issue is that any emoji or special character are not rendering on the subject header of the pug file. but working perfectly on the body. I compile both body and subject header differently using pug.

const compileHtmlFunction = pug.compileFile(
    path.join(__dirname, "../emails", templatePath, "html.pug")
  );



const getSubjectFunction = pug.compileFile(
    path.join(__dirname, "../emails", templatePath, "subject.pug")
  );

const payload = {


  DestinationEmail: to,
    SourceEmail: fromEmail ? `Switch By Sterling ${fromEmail}` : "Switch By Sterling team@switch-ng.com",
    Body: compileHtmlFunction(data),
    Subject: getSubjectFunction(data)
  };

"""""""""""""""""""""""""""""""html.pug

doctype html
include ../../layouts/header

div(style='display: none; max-height: 0; overflow: hidden;')
div(style='background-color: #ecedfa; line-height: 30px; padding-top:5px;')
  div(style='background-color: #ffffff; color: #484347;  margin: 0 auto; margin-top: 100px; max-width: 400px; padding: 20px;')
    div 
      center 
        img(src='https://res.cloudinary.com/dzkyrqr5e/image/upload/v1648553921/new-headers/password-reset_ait4kd.png' alt='' width='100%' height="100%" border='0' style='display: block; margin: 20px auto 20px auto;')
    p(style='margin: 0 0 5px 0;')
      | Hello #{first_name},
      br
      | You are receiving this email because there has been a password change request on your account.
      | If you initiated this request, please change your password by clicking the 'Change my password' button below. The link will expire after 10 minutes.
      br
      a(href=updatePasswordUrl) Change my password
      br
      | If you didn't request this, please ignore this email. Your password won't change until you access the link above and create a new one.
      br
      p(style='margin: 0') With 💜
      | Your friends at Switch

    include ../../layouts/footer_image

""""""""""""""""""""""""""""subject.pug

| Launch  💜
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The subject line of an email isn't rendered like an HTML file, so I don't think you want to escape the emoji in the subject.

Try changing your subject.pug file to:

| Launch 💜
about 4 years ago · Juan Pablo Isaza Denunciar
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