Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

304
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda