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

117
Visualizações
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 à 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