public ClientMessageReceivedEventArgs(ITcpClientAdapter client, CancellationToken cancellationToken,
     ClientMessage clientMessage)
 {
     Client = client;
     CancellationToken = cancellationToken;
     ClientMessage = clientMessage;
 }
        public override void MessageReceived(ClientMessage clientMessage)
        {
            base.MessageReceived(clientMessage);

            _messager.SendMessage(_client, new OutboundMessageReadyForData());

            _client.ChangeState(new AwaitingDataState(_client, _messager, _mimeParser));
        }
        public override void MessageReceived(ClientMessage clientMessage)
        {
            base.MessageReceived(clientMessage);

            _messager.SendMessage(_client, new OutboundMessageSessionGreeting(clientMessage.MessageText));
            _messager.SendMessage(_client, new OutboundMessageAuth());

            _client.ChangeState(new AwaitingAuthState(_client, _messager, _mimeParser));
        }
예제 #4
0
        public EmailMessage MessageReceived(ClientMessage clientMessage)
        {
            _clientState.MessageReceived(clientMessage);

            if (Message != null && Message.Complete)
                return Message;

            return null;
        }
        public override void MessageReceived(ClientMessage clientMessage)
        {
            base.MessageReceived(clientMessage);

            // We don't care about the password
            _messager.SendMessage(_client, new OutboundMessageAuthSuccessful());

            _client.ChangeState(new AwaitingMailCommandState(_client, _messager, _mimeParser));
        }
        public override void MessageReceived(ClientMessage clientMessage)
        {
            base.MessageReceived(clientMessage);

            _client.Message.Recipients.Add(SmtpUtilities.ExtractEmailAddress(clientMessage.MessageText));

            _messager.SendMessage(_client, new OutboundMessageOK());

            _client.ChangeState(new AwaitingDataCommandState(_client, _messager, _mimeParser));
        }
예제 #7
0
        public override void MessageReceived(ClientMessage clientMessage)
        {
            base.MessageReceived(clientMessage);

            var message = SmtpUtilities.ExtractAuthLogin(clientMessage.MessageText);

            _client.Group = Encoding.UTF8.GetString(Convert.FromBase64String(message));
            _messager.SendMessage(_client, new OutboundMessageAuthPassword());

            _client.ChangeState(new AwaitingAuthPasswordState(_client, _messager, _mimeParser));
        }
        public override void MessageReceived(ClientMessage clientMessage)
        {
            base.MessageReceived(clientMessage);

            var sender = SmtpUtilities.ExtractEmailAddress(clientMessage.MessageText);

            _client.Message = new EmailMessage
            {
                Sender = sender,
                Group = _client.Group
            };

            _messager.SendMessage(_client, new OutboundMessageOK());

            _client.ChangeState(new AwaitingRcptCommandState(_client, _messager, _mimeParser));
        }
예제 #9
0
        public virtual void MessageReceived(ClientMessage clientMessage)
        {
            if (clientMessage.SMTPCommand == SmtpCommand.NOOP)
            {
                _messager.SendMessage(_client, new OutboundMessageOK());
            }

            if (clientMessage.SMTPCommand == SmtpCommand.QUIT)
            {
                _messager.SendMessage(_client, new OutboundMessageClosingTransmission());
                _messager.DisconnectClient(_client);
            }

            if (!ValidMessage(clientMessage))
            {
                _messager.SendMessage(_client, new OutboundMessageBadSequence());
            }
        }
예제 #10
0
 public override bool ValidMessage(ClientMessage clientMessage)
 {
     return clientMessage.SMTPCommand == SmtpCommand.AUTH;
 }
예제 #11
0
 public abstract bool ValidMessage(ClientMessage clientMessage);
 public override bool ValidMessage(ClientMessage clientMessage)
 {
     // We're expecting a password, so the message is always valid
     return true;
 }