fix(mail): migrate filesystem helpers to fsUtils, update DKIM and mail APIs, harden SMTP client, and bump dependencies
This commit is contained in:
@@ -400,13 +400,13 @@ export class EmailSendJob {
|
||||
const fileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_success.eml`;
|
||||
const filePath = plugins.path.join(paths.sentEmailsDir, fileName);
|
||||
|
||||
await plugins.smartfile.fs.ensureDir(paths.sentEmailsDir);
|
||||
await plugins.smartfile.memory.toFs(emailContent, filePath);
|
||||
await plugins.fsUtils.ensureDir(paths.sentEmailsDir);
|
||||
await plugins.fsUtils.toFs(emailContent, filePath);
|
||||
|
||||
// Also save delivery info
|
||||
const infoFileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_info.json`;
|
||||
const infoPath = plugins.path.join(paths.sentEmailsDir, infoFileName);
|
||||
await plugins.smartfile.memory.toFs(JSON.stringify(this.deliveryInfo, null, 2), infoPath);
|
||||
await plugins.fsUtils.toFs(JSON.stringify(this.deliveryInfo, null, 2), infoPath);
|
||||
|
||||
this.log(`Email saved to ${fileName}`);
|
||||
} catch (error) {
|
||||
@@ -424,13 +424,13 @@ export class EmailSendJob {
|
||||
const fileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_failed.eml`;
|
||||
const filePath = plugins.path.join(paths.failedEmailsDir, fileName);
|
||||
|
||||
await plugins.smartfile.fs.ensureDir(paths.failedEmailsDir);
|
||||
await plugins.smartfile.memory.toFs(emailContent, filePath);
|
||||
await plugins.fsUtils.ensureDir(paths.failedEmailsDir);
|
||||
await plugins.fsUtils.toFs(emailContent, filePath);
|
||||
|
||||
// Also save delivery info with error details
|
||||
const infoFileName = `${Date.now()}_${this.email.from}_to_${this.email.to[0]}_error.json`;
|
||||
const infoPath = plugins.path.join(paths.failedEmailsDir, infoFileName);
|
||||
await plugins.smartfile.memory.toFs(JSON.stringify(this.deliveryInfo, null, 2), infoPath);
|
||||
await plugins.fsUtils.toFs(JSON.stringify(this.deliveryInfo, null, 2), infoPath);
|
||||
|
||||
this.log(`Failed email saved to ${fileName}`);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user