private void OnMailCommandHandler(ReceiveCommandEventSource source, MailCommandEventArgs e)
 {
     Logger.Debug("[GenericTransportAgent] SmtpReceiveAgent - OnMailCommand fired...");
     foreach (var x in Configuration.Config.SmtpReceiveAgentConfig.OnMailCommand)
     {
         try
         {
             x.Execute();
         }
         catch (Exception ex)
         {
             Logger.Error(ex, @"Error executing ""OnMailCommand""");
         }
     }
 }
Example #2
0
 private void MailCommandHandler(ReceiveCommandEventSource source, MailCommandEventArgs args)
 {
     DeliveryThrottling.Instance.SetSessionMessageSize(args.Size, args.SmtpSession.SessionId);
     if (!DeliveryConfiguration.Instance.Throttling.DynamicMailboxDatabaseThrottlingEnabled)
     {
         return;
     }
     if (this.destinationMdbGuid == Guid.Empty || this.connectionManager == null)
     {
         DeliveryThrottlingAgent.Diag.TraceDebug <long>(0, (long)this.GetHashCode(), "Dynamic Throttling: No destination mailbox database specified for this connection, no throttling applied. SessionId {0}", args.SmtpSession.SessionId);
         return;
     }
     if (this.mailboxDatabaseConnectionInfo != null)
     {
         DeliveryThrottlingAgent.Diag.TraceDebug <long>(0, (long)this.GetHashCode(), "Dynamic Throttling: Connection was previously acquired. Being released before attempt to reacquire. SessionId {0}", args.SmtpSession.SessionId);
         this.connectionManager.Release(ref this.mailboxDatabaseConnectionInfo);
     }
     if (!DeliveryThrottling.Instance.CheckAndTrackDynamicThrottleMDBTimeout(this.destinationMdbGuid, this.mailboxDatabaseConnectionInfo, this.connectionManager, args.SmtpSession.SessionId, args.SmtpSession.RemoteEndPoint.Address, this.defaultConnectionWait, this.mdbHealthMonitors))
     {
         DeliveryThrottling.Instance.DecrementCurrentMessageSize(args.SmtpSession.SessionId);
         source.RejectCommand(AckReason.DynamicMailboxDatabaseThrottlingLimitExceeded);
     }
     this.connectionManager.UpdateLastActivityTime(args.SmtpSession.SessionId);
 }
 void OnMailCommandHandler(ReceiveCommandEventSource source, MailCommandEventArgs e)
 {
     Logger.Debug("[GenericTransportAgent] SmtpReceiveAgent - OnMailCommand fired...");
     _config.SmtpReceiveAgentConfig.OnMailCommand.ToList().ForEach(x => { try { x.Execute(); } catch (Exception ex) { Logger.Error(ex, @"Error executing ""OnMailCommand"""); } });
 }
Example #4
0
 void OnMailCommandHandler(ReceiveCommandEventSource source, MailCommandEventArgs e)
 {
     Logger.Debug("[GenericExchangeTransportagent] [SmtpReceiveAgent] OnMailCommand fired...");
     _config.SmtpReceiveAgentConfig.OnMailCommand.ToList().ForEach(x => { try { x.Execute(); } catch (Exception ex) { Logger.Error(ex, @"Error executing ""OnMailCommand"""); } });
 }