This commit is contained in:
2025-05-21 16:17:17 +00:00
parent c3ae995372
commit 2eeb731669
7 changed files with 779 additions and 163 deletions

View File

@ -196,7 +196,19 @@ export class SmtpServer implements ISmtpServer {
// Start secure server if configured
if (this.options.securePort && this.tlsHandler.isTlsEnabled()) {
try {
this.secureServer = this.tlsHandler.createSecureServer();
// Import the secure server creation utility from our new module
// This gives us better certificate handling and error resilience
const { createSecureTlsServer } = await import('./secure-server.js');
// Create secure server with the certificates
// This uses a more robust approach to certificate loading and validation
this.secureServer = createSecureTlsServer({
key: this.options.key,
cert: this.options.cert,
ca: this.options.ca
});
SmtpLogger.info(`Created secure TLS server for port ${this.options.securePort}`);
if (this.secureServer) {
// Use explicit error handling for secure connections