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

86
Vistas
MIME Message, missing fields in mail

I have this function MIME message that I then POST to google draft API. When manually checking in my drafts, the mailContent show's up properly.

  const mailContent = req.body.content

  .
  .
  .


  var message = 'MIME-Version: 1.0\r\n' +
  'Content-type: multipart/alternative; boundary=boundaryboundary\r\n\r\n' +
  '--boundaryboundary\r\n' +
  'Content-type: text/plain; charset=UTF-8\r\n' +
  mailContent + "\r\n\r\n" +
  '--boundaryboundary--';

Now I'm trying to add the From, To and Subject fields in my MIME message, and after quite some research, I thought that adding them to the 'body' like so would do the trick:

  const mailContent = req.body.content
  const from = "exyleprod@gmail.com"
  const to = req.body.to || ""
  const subject = req.body.subject || ""
  .
  .
  .

  var message = 'MIME-Version: 1.0\r\n' +
  'Content-type: multipart/alternative; boundary=boundaryboundary\r\n\r\n' +
  'From: SomeName ' + '<' + from + '>' + "\r\n" +
  'To: ' + '<' + to + '>' + "\r\n" +
  'Subject: ' + subject + "\r\n" +
  '--boundaryboundary\r\n' +
  'Content-type: text/plain; charset=UTF-8\r\n' +
  mailContent + "\r\n\r\n" +
  '--boundaryboundary--';

But it doesn't... I've tried logging the added fields and they are what I expect. The POST still work's and successfully create's an other draft with the mailContent. However, the 3 fields I'm trying to add don't show up. An I doing this wrong ?

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

0

Try to do it this way:

var message = {
  from: "sender@example.com",
  to: "receiver@example.com",
  subject: "Message title",
  text: "Plaintext version of the message",
  html: "<p>HTML version of the message</p>"
};
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