fix(mail): migrate filesystem helpers to fsUtils, update DKIM and mail APIs, harden SMTP client, and bump dependencies
This commit is contained in:
@@ -57,7 +57,7 @@ export class DNSManager {
|
||||
}
|
||||
|
||||
// Ensure the DNS records directory exists
|
||||
plugins.smartfile.fs.ensureDirSync(paths.dnsRecordsDir);
|
||||
plugins.fsUtils.ensureDirSync(paths.dnsRecordsDir);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -417,7 +417,7 @@ export class DNSManager {
|
||||
public async saveDnsRecommendations(domain: string, records: IDnsRecord[]): Promise<void> {
|
||||
try {
|
||||
const filePath = plugins.path.join(paths.dnsRecordsDir, `${domain}.recommendations.json`);
|
||||
plugins.smartfile.memory.toFsSync(JSON.stringify(records, null, 2), filePath);
|
||||
plugins.fsUtils.toFsSync(JSON.stringify(records, null, 2), filePath);
|
||||
console.log(`DNS recommendations for ${domain} saved to ${filePath}`);
|
||||
} catch (error) {
|
||||
console.error(`Error saving DNS recommendations for ${domain}:`, error);
|
||||
|
||||
@@ -836,19 +836,14 @@ export class UnifiedEmailServer extends EventEmitter {
|
||||
}
|
||||
|
||||
// Sign the email
|
||||
const dkimKeys = await this.dkimCreator.readDKIMKeys(options.dkimOptions.domainName);
|
||||
const signResult = await plugins.dkimSign(rawEmail, {
|
||||
signingDomain: options.dkimOptions.domainName,
|
||||
selector: options.dkimOptions.keySelector || 'mta',
|
||||
privateKey: dkimKeys.privateKey,
|
||||
canonicalization: 'relaxed/relaxed',
|
||||
algorithm: 'rsa-sha256',
|
||||
signTime: new Date(),
|
||||
signatureData: [
|
||||
{
|
||||
signingDomain: options.dkimOptions.domainName,
|
||||
selector: options.dkimOptions.keySelector || 'mta',
|
||||
privateKey: (await this.dkimCreator.readDKIMKeys(options.dkimOptions.domainName)).privateKey,
|
||||
algorithm: 'rsa-sha256',
|
||||
canonicalization: 'relaxed/relaxed'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Add the DKIM-Signature header to the email
|
||||
@@ -1435,18 +1430,12 @@ export class UnifiedEmailServer extends EventEmitter {
|
||||
|
||||
// Sign the email
|
||||
const signResult = await plugins.dkimSign(rawEmail, {
|
||||
signingDomain: domain,
|
||||
selector: selector,
|
||||
privateKey: privateKey,
|
||||
canonicalization: 'relaxed/relaxed',
|
||||
algorithm: 'rsa-sha256',
|
||||
signTime: new Date(),
|
||||
signatureData: [
|
||||
{
|
||||
signingDomain: domain,
|
||||
selector: selector,
|
||||
privateKey: privateKey,
|
||||
algorithm: 'rsa-sha256',
|
||||
canonicalization: 'relaxed/relaxed'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// Add the DKIM-Signature header to the email
|
||||
|
||||
Reference in New Issue
Block a user