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",
Username : "[email protected]",
Password : "abc",
To : receiver,
From : "[email protected]",
Subject : emailSubject,
Body : emailBody,
Attachments : [
{
}]
}).then(
)
});
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.",
Username : "[email protected]",
Password : "abc",
To : receiver,
From : "[email protected]",
Subject : emailSubject,
Body : emailBody,
Attachments : [
{
}]
}).then(
)
});
Share
Improve this question
edited Apr 21, 2021 at 20:15
Linda Paiste
42.4k8 gold badges80 silver badges116 bronze badges
asked Dec 17, 2019 at 18:29
shagi.Gshagi.G
1511 gold badge2 silver badges10 bronze badges
1 Answer
Reset to default 3 Email.send({
Host: "smtp.gmail.",
Username : "[email protected]",
Password : "abc",
To : receiver,
From : "[email protected]",
Subject : emailSubject,
Body : emailBody,
Attachments : [
{
name : list.pdf
data : pdfBase64
}]
}).then(
)
});
This worked ! The created pdf got added to the email as an attachment