@push.rocks/smartmta 5.3.3 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -158,6 +158,12 @@ interface ISmtpServerConfig {
158
158
  maxAuthFailures?: number;
159
159
  socketTimeoutSecs?: number;
160
160
  processingTimeoutSecs?: number;
161
+ recipientValidationEnabled?: boolean;
162
+ recipientValidationTimeoutSecs?: number;
163
+ proxyProtocol?: {
164
+ required?: boolean;
165
+ trustedIps?: string[];
166
+ };
161
167
  rateLimits?: IRateLimitConfig;
162
168
  }
163
169
 
@@ -187,6 +193,18 @@ interface IEmailReceivedEvent {
187
193
  securityResults: any | null;
188
194
  }
189
195
 
196
+ interface IRcptToRequestEvent {
197
+ correlationId: string;
198
+ sessionId: string;
199
+ mailFrom: string;
200
+ rcptTo: string;
201
+ acceptedRcptTo: string[];
202
+ remoteAddr: string;
203
+ clientHostname: string | null;
204
+ secure: boolean;
205
+ authenticatedUser: string | null;
206
+ }
207
+
190
208
  interface IAuthRequestEvent {
191
209
  correlationId: string;
192
210
  sessionId: string;
@@ -274,6 +292,15 @@ type TMailerCommands = {
274
292
  };
275
293
  result: { resolved: boolean };
276
294
  };
295
+ rcptToResult: {
296
+ params: {
297
+ correlationId: string;
298
+ accepted: boolean;
299
+ smtpCode?: number;
300
+ smtpMessage?: string;
301
+ };
302
+ result: { resolved: boolean };
303
+ };
277
304
  authResult: {
278
305
  params: {
279
306
  correlationId: string;
@@ -859,6 +886,19 @@ export class RustSecurityBridge extends EventEmitter {
859
886
  await this.bridge.sendCommand('emailProcessingResult', opts);
860
887
  }
861
888
 
889
+ /**
890
+ * Send the result of recipient policy validation back to the Rust SMTP server.
891
+ */
892
+ public async sendRcptToResult(opts: {
893
+ correlationId: string;
894
+ accepted: boolean;
895
+ smtpCode?: number;
896
+ smtpMessage?: string;
897
+ }): Promise<void> {
898
+ this.ensureRunning();
899
+ await this.bridge.sendCommand('rcptToResult', opts);
900
+ }
901
+
862
902
  /**
863
903
  * Send the result of authentication validation back to the Rust SMTP server.
864
904
  */
@@ -905,6 +945,13 @@ export class RustSecurityBridge extends EventEmitter {
905
945
  this.bridge.on('management:emailReceived', handler);
906
946
  }
907
947
 
948
+ /**
949
+ * Register a handler for RCPT TO policy requests from the Rust SMTP server.
950
+ */
951
+ public onRcptToRequest(handler: (data: IRcptToRequestEvent) => void): void {
952
+ this.bridge.on('management:rcptToRequest', handler);
953
+ }
954
+
908
955
  /**
909
956
  * Register a handler for authRequest events from the Rust SMTP server.
910
957
  * The handler must call sendAuthResult() with the correlationId.
@@ -926,6 +973,11 @@ export class RustSecurityBridge extends EventEmitter {
926
973
  this.bridge.off('management:emailReceived', handler);
927
974
  }
928
975
 
976
+ /** Remove an RCPT TO policy request handler. */
977
+ public offRcptToRequest(handler: (data: IRcptToRequestEvent) => void): void {
978
+ this.bridge.off('management:rcptToRequest', handler);
979
+ }
980
+
929
981
  /** Remove an authRequest event handler. */
930
982
  public offAuthRequest(handler: (data: IAuthRequestEvent) => void): void {
931
983
  this.bridge.off('management:authRequest', handler);
@@ -952,6 +1004,7 @@ export type {
952
1004
  IRateLimitConfig,
953
1005
  IEmailData,
954
1006
  IEmailReceivedEvent,
1007
+ IRcptToRequestEvent,
955
1008
  IAuthRequestEvent,
956
1009
  IScramCredentialRequestEvent,
957
1010
  IOutboundEmail,