Skip to content
Snippets Groups Projects
Commit 64b52b7a authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: add send mail for test purpose

parent 6d16a17f
No related branches found
No related tags found
3 merge requests!103Support,!102Dev,!83Features/113 bilan mensuel
......@@ -21,7 +21,7 @@
"public": false
}
},
"service": {
"services": {
"monthlySummary": {
"type": "node",
"file": "monthlySummary.js",
......
......@@ -50,6 +50,25 @@ const monthlySummaryStats = async () => {
const consumptions = await fetchConsumptionsForPeriod(period)
const meanConsumptions = getMeanOnPeriod(consumptions, period)
const FEEDBACK_EMAIL = 'ecolyo@grandlyon.com'
const mailContent = 'TEST'
const mailData = {
mode: 'from',
to: [{ name: 'Support', email: FEEDBACK_EMAIL }],
subject: '[Ecolyo] - Votre bilan mensuel',
parts: [{ type: 'text/plain', body: mailContent }],
}
try {
const jobCollection = client.collection('io.cozy.jobs')
await jobCollection.create('sendmail', mailData)
} catch (e) {
// eslint-disable-next-line no-console
console.error(e)
setError(t('feedback.error_sending'))
}
log(
'info',
`${consumptions.length} consumptions between ${period.start} and ${period.end}`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment