This is my code for a function node that sends an email, nowadays it's showing a table on the email. but this information is the same of a local document. The path of my document is D:\POSTMAN\202211300701Energia.csv so I need to attach it.
This is my actual code:
//Importante
//Se reemplaza el Token enviado por el servidor para el proximo envio de email.
msg.payload.item[0].request.auth.bearer[0].value = msg.keygen;
//Se elimina la variable keygen para no generar problemas en el objeto que se esta creando
delete msg.keygen;
//Se captura la hora y fecha del sistema y se construye un string para el subject del email
var d = new Date(); // create current date object for the time string
var tstring = d.toString().substring(0, 4) + d.toString().substring(15, 21);
//Armado del cuerpo del email para el envio de datos a los responsables
var subjectemail = "Reporte diario de Energia del Sistema de Ventilacion " + tstring; // email subject
var bodyemail = msg.hmtl;
//Generacion del cuerpo del Email
var cadena = {
"to": {
"to": [
{
"email": "mvalencia@controltotal.com.pe"
}, {
"email": "sbernabe@controltotal.com.pe"
}
/* {
"email": "mvalencia@controltotal.com.pe"
}, {
"email": "dparedes@controltotal.com.pe"
},{
"email": "jchavez@controltotal.com.pe"
}*/
],
"cc": [
/*{
"email": "jralejo@controltotal.com.pe"
}*/
],
"bcc": [
],
"replyTo": {
"email": ""
}
},
"from": {
"email": "sipddss@mineriabreca.com"
},
"files": [
],
"subject-mail": subjectemail,
"content-mail": bodyemail, //Cuerpo del Email
"sendManager": "1"
}
//msg.payload = cadena;
msg.payload.item[0].request.body.raw = cadena;
return msg;
So I think that I need to attach this on "files" but I don't know how to attach this propertly