Пример #1
0
        /// <summary>
        /// Handles the file system watcher created event.
        /// </summary>
        private void Watcher_Created(object sender, FileSystemEventArgs e)
        {
            FileInfo file = new FileInfo(e.FullPath);

            if (EmlFile.IsUnsentMail(file))
            {
                this.OnNewEmail(file);
            }
        }
Пример #2
0
        /// <summary>
        /// Gets all eml-files from the mailfolder that are marked as unsent.
        /// </summary>
        /// <param name="start">The start.</param>
        /// <param name="mails">The mails.</param>
        private void GetUnblockedAndUnsentEmlFilesInDirectory(DirectoryInfo start, ref List <FileInfo> mails)
        {
            foreach (DirectoryInfo current in start.GetDirectories())
            {
                this.GetUnblockedAndUnsentEmlFilesInDirectory(current, ref mails);
            }

            foreach (FileInfo current in start.GetFiles())
            {
                if (
                    EmlFile.IsUnblocked(current) &&
                    EmlFile.IsUnsentMail(current) &&
                    ForwardingConfiguration.IsConfiguredForForwarding(EmlFile.GetRecepientDomain(current)))
                {
                    mails.Add(current);
                }
            }
        }