1

I am creating a pdf by converting my html file to pdf using jsPDF

var doc = new jsPDF();
 var specialElementHandlers = {
  '#fav-items': function (element, renderer) {
      return true;
  }
   };

 $('#submit').click(function () {
  doc.fromHTML($('#fav-items').html(), 15, 15, {
      'width': 170,
          'elementHandlers': specialElementHandlers
  });

  var pdfBase64 = doc.output('datauristring');

I am then sending an email using the smtpjs. The email is sent successfull but couldnt attach the pdf file. Please guide me through this.

The code to send the email

Email.send({
Host: "smtp.gmail.com",
Username : "abc@gmail.com",
Password : "abc",
To : receiver,
From : "abc@gmail.com",
Subject : emailSubject,
Body : emailBody,
Attachments : [
  {

  }]
}).then(
)
});
Linda Paiste
  • 38,446
  • 6
  • 64
  • 102
shagi.G
  • 121
  • 1
  • 2
  • 10

1 Answers1

3
     Email.send({
     Host: "smtp.gmail.com",
     Username : "abc@gmail.com",
     Password : "abc",
     To : receiver,
     From : "abc@gmail.com",
     Subject : emailSubject,
     Body : emailBody,
     Attachments : [
     {
      name : list.pdf
      data : pdfBase64 

     }]
     }).then(
     )
     });

This worked ! The created pdf got added to the email as an attachment

shagi.G
  • 121
  • 1
  • 2
  • 10