@@ -25,10 +25,10 @@ const base32 = require('base32.js');
25
25
// handle DNS resolving
26
26
require ( './ip-tools' ) ;
27
27
28
- const ttlMinutes = [
28
+ const DEFAULT_DEFER_TIMES = [
29
29
5 /* 5 */ , 7 /* 12 */ , 8 /* 20 */ , 25 /* 45 */ , 75 /* 2h */ , 120 /* 4h */ , 240 /* 8h */ , 240 /* 12h */ , 240 /* 16h */ , 240 /* 20h */ , 240 /* 24h */ ,
30
30
240 /* 28h */ , 240 /* 32h */ , 240 /* 36h */ , 240 /* 40h */ , 240 /* 44h */ , 240 /* 48h */
31
- ] ;
31
+ ] . map ( v => v * 60 * 1000 ) ;
32
32
33
33
const POLICY_RESPONSE = '550 Failed to establish a TLS connection to the MX server as requested by policy' ;
34
34
@@ -143,7 +143,9 @@ class Sender extends EventEmitter {
143
143
return ;
144
144
}
145
145
responseSent = true ;
146
- this . handleResponseError ( delivery , connection , err , continueSending ) ;
146
+ plugins . handler . runHooks ( 'sender:responseError' , [ delivery , connection , err ] , ( ) => {
147
+ this . handleResponseError ( delivery , connection , err , continueSending ) ;
148
+ } ) ;
147
149
} ;
148
150
149
151
this . sendCommand ( 'GET' , ( err , delivery ) => {
@@ -723,9 +725,10 @@ class Sender extends EventEmitter {
723
725
bounce . action = 'reject' ;
724
726
}
725
727
726
- if ( bounce . action !== 'reject' && deferredCount < ttlMinutes . length ) {
727
- //let ttl = Math.min(Math.pow(5, Math.min(deferredCount + 1, 4)), 180) * 60 * 1000;
728
- let ttl = ttlMinutes [ deferredCount ] * 60 * 1000 ;
728
+ const deferTimes = delivery . deferTimes && Array . isArray ( delivery . deferTimes ) && delivery . deferTimes . length ? delivery . deferTimes : DEFAULT_DEFER_TIMES ;
729
+
730
+ if ( bounce . action !== 'reject' && deferredCount < deferTimes . length ) {
731
+ const ttl = deferTimes [ deferredCount ] ;
729
732
log . info (
730
733
this . logName ,
731
734
'id=%s %s.%s DEFERRED[%s] from=%s to=%s src=%s mx=%s id=%s (%s)' ,
0 commit comments