Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!