Hi All,
I use a module in Meteor for sending email with attachments. I Send a test mail on my mailbox and recieve a destroyed attachment with size 1KB. I send img/pdf’s and I allways get same effect. Please help
Template.dashboard.events({
'click .sendMail': (e)=>{
e.preventDefault();
let mailAdd = $('.mailAddress').val();
let mailCon = $('.mailContent').val();
let mailTitle = $('.mailTitle').val();
Meteor.call('sendEmail',mailAdd, 'xxxxxx@xxxxxxx.pl',mailTitle, mailCon);
}
})
Meteor.methods({
sendEmail: function (to, from, subject, text,attachments) {
check([to, from, subject, text], [String]);
process.env.MAIL_URL = '###my##hashed###SMTP####';
this.unblock();
Email.send({
to: to,
from: from,
subject: subject,
text: text,
attachments : attachments = [
{
fileName : "book.pdf" ,
filePath: "/home/hexen/Downloads",
contents: "this is a test attachment."
},
]
});
console.log('Mail wysłany do: ',to);
console.log('Przesłany przez: ',from);
console.log('Temat: ',subject);
console.log('Treść: ',text);
console.log('Załącznik', attachments);
}
});