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(
)
});
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.