Exemplo n.º 1
0
        public IMailMessage FetchMail(int messageNumber)
        {
            if (m_CurrentState is DisconnectedState)
            {
                if (!Connect())
                {
                    return(new mime.RFC2045.NullMessage());
                }
            }

            if (m_CurrentState is AuthorizationState)
            {
                if (!Authenticate())
                {
                    return(new mime.RFC2045.NullMessage());
                }
            }

            RFC1939.RetriveCommand command = new RFC1939.RetriveCommand(m_Stream, messageNumber);
            if (IssueCommand(command))
            {
                IMailMessage message;
                lock (m_Stream)
                {
                    message = m_MailReader.Read(ref m_Stream, this);
                }
                this.CurrentState = TransactionState.GetInstance();
                return(message);
            }
            return(new mime.RFC2045.NullMessage());
        }
Exemplo n.º 2
0
        public void Execute(IJobExecutionContext context)
        {
            LoggUtil.LoggingMessage("The Email Job has been started");
            var data = _reader.Read();

            Parallel.ForEach(data,
                             currentElement =>
            {
                _sender.SendEmailAsync(currentElement);
            });
            LoggUtil.LoggingMessage("The Email Job has been ended");
        }