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

154
Visualizações
Nodemailer is sending emails with the same subject as thread

Nodemailer is sending emails as a thread if the email has the same subject as a previously sent email. But I want to send the emails as separate emails, even if they have the same subject as each other.

I have an application that sends notification emails to users. The emails all have the same subject: notification. This is causing the emails to show as a thread, at least in Gmail:

enter image description here

How can I make each notification email send separately?

const nodemailer = require('nodemailer');

const logger = require('./logger');

class Email {
  constructor(email, to, pass) {
    this.user = email;
    this.to = to;
    this.pass = pass;
  }

  get mailOptions() {
    return {
      from: this.user,
      to: this.to,
      subject: 'notification',
      html: 'You received a new purchase in your shop.',
    };
  }

  get transporter() {
    const transporter = nodemailer.createTransport({
// for zoho emails
      host: 'smtp.zoho.com',
      port: 587,
      secure: false,
      auth: {
        user: this.user,
        pass: this.pass,
      },
    });

    return transporter;
  }

  send(cb) {
    this.transporter.sendMail(
      this.mailOptions,
      cb ||
        ((error, info) => {
          if (error) console.log(error);
          if (info) logger.log('silly', `message sent: ${info.messageId}`);
          this.transporter.close();
        })
    );
  }

  sendSync() {
    return new Promise((res, rej) =>
      this.transporter.sendMail(this.mailOptions, (error, info) => {
        if (error) rej(error);
        else res(info);
        this.transporter.close();
      })
    );
  }
}

const email = new Email(
  'somesendingemail@gmail.com',
  'somereceivingemail@gmail.com',
  'SendINgEmAIlPassWoRD'
);

email.send();
over 4 years ago · Santiago Trujillo
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