public bool SpoolMessage(SMTPMessage message)
 {
     return
         _processor.Process(
             new CommandMessage(
                 message.Data, message.FromAddress.Address,
                 message.ToAddresses.Select(a => a.Address).AsEnumerable(),
                 message.MessageParts.Select(a => new CommandMessageAttachment
                                                      {
                                                          Data = a.BodyData,
                                                          Header = a.HeaderData,
                                                          Headers = a.Headers
                                                      }), message.Headers));
 }
Example #2
0
        /// <summary>
        /// Initialize this context for a given socket connection.
        /// </summary>
        public SMTPContext(long connectionId, Socket socket)
        {
            if (Log.IsDebugEnabled)
                Log.DebugFormat(
                    Resources.Log_Connection_0_New_connection_from_client_1,
                    connectionId,
                    socket.RemoteEndPoint);

            _connectionId = connectionId;
            _lastCommand = -1;
            _socket = socket;
            _message = new SMTPMessage();

            // Set the encoding to ASCII.
            _encoding = Encoding.ASCII;

            // Initialize the input buffer
            _inputBuffer = new StringBuilder();
        }
Example #3
0
 /// <summary>
 /// Resets this context for a new message
 /// </summary>
 public void Reset()
 {
     if (Log.IsDebugEnabled)
         Log.DebugFormat(Resources.Log_Connection_0_Reset, _connectionId);
     _message = new SMTPMessage();
     _lastCommand = SMTPProcessor.CommandHelo;
 }