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

116
Vistas
Sendinblue attachment Preview

I am getting the mails along with attachment from below code. But unable to view the attachment content when I downloaded the attachment.

attachmentpreview

function sendEmail() {

var fileInput = document.getElementById('customFile');
var base64 = "";
var reader = new FileReader();
reader.readAsDataURL(fileInput.files[0]);

reader.onload = function () {
    console.log(reader.result);//base64encoded string
    sendAttachmentinEmail(base64);
};
reader.onerror = function (error) {
    console.log('Error: ', error);
};

}

function sendAttachmentinEmail(base64) {

var attachment = { 'name': 'sample.doc', 'content': base64, };

var email = "";
var strJSON = {
    sender: {
        email: "noreply@test.com"
    },
    to: [{
        email: "mymailid"
    }],
    replyTo: {
        email: "mymailid"
    },
    htmlContent: "Name: test",
    "attachment": [attachment]
}

let url = 'https://api.sendinblue.com/v3/smtp/email';
let options = {
    method: 'POST',
    headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json',
        'api-key': 'MY_API_KEY'
    },
    body: JSON.stringify(strJSON)
};

fetch(url, options)
    .then(res => res.json())
    .then(json => alert(json))
    .catch(err => alert('error:' + err));

}

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