fix(smtp): log attachment files sent through email
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
7894b32163
commit
b7e58aa9cd
|
@ -24,13 +24,24 @@ module.exports = {
|
|||
|
||||
throw err;
|
||||
}).finally(async() => {
|
||||
const attachments = [];
|
||||
for (let attachment of options.attachments) {
|
||||
const fileName = attachment.filename;
|
||||
const filePath = attachment.path;
|
||||
// if (fileName.includes('.png')) return;
|
||||
|
||||
if (fileName || filePath)
|
||||
attachments.push(filePath ? filePath : fileName);
|
||||
}
|
||||
const fileNames = attachments.join(',\n');
|
||||
await db.rawSql(`
|
||||
INSERT INTO vn.mail (receiver, replyTo, sent, subject, body, status)
|
||||
VALUES (?, ?, 1, ?, ?, ?)`, [
|
||||
INSERT INTO vn.mail (receiver, replyTo, sent, subject, body, attachment, status)
|
||||
VALUES (?, ?, 1, ?, ?, ?, ?)`, [
|
||||
options.to,
|
||||
options.replyTo,
|
||||
options.subject,
|
||||
options.text || options.html,
|
||||
fileNames,
|
||||
error && error.message || 'Sent'
|
||||
]);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue