/// <summary> /// Method will load IP addresses from the database if required. /// This method should be called before doing anything with the /// private IP collections. /// </summary> private static void LoadVirtualMtas() { if (_vmtaCollection != null && _lastGotVirtualMtas.AddMinutes(MtaParameters.MTA_CACHE_MINUTES) > DateTime.UtcNow) { return; } _outboundMtas = null; _inboundMtas = null; _vmtaCollection = DAL.VirtualMtaDB.GetVirtualMtas(); }
/// <summary> /// Gets a collection of IP address that can be used /// by the MTA for sending of messages. /// </summary> /// <returns></returns> public static VirtualMTACollection GetVirtualMtasForSending() { LoadVirtualMtas(); if (_outboundMtas == null) { _outboundMtas = new VirtualMTACollection(from ip in _vmtaCollection where ip.IsSmtpOutbound select ip); } return(_outboundMtas); }
/// <summary> /// Returns a collection of IP addresses that should be /// used by the MTA for receiving messages. /// </summary> /// <returns></returns> public static VirtualMTACollection GetVirtualMtasForListeningOn() { LoadVirtualMtas(); if (_inboundMtas == null) { _inboundMtas = new VirtualMTACollection(from ip in _vmtaCollection where ip.IsSmtpInbound select ip); } return(_inboundMtas); }