Ejemplo n.º 1
0
        private void Data(SmtpContext context)
        {
            context.WriteLine(MessageStartData);

            var messageData    = context.MessageData;
            var clientEndPoint = (IPEndPoint)context.Socket.RemoteEndPoint;
            var header         = new StringBuilder();

            header.Append(String.Format("Received: from {0} ({0} [{1}])\r\n", context.ClientDomain, clientEndPoint.Address));

            messageData.AddData(header.ToString());

            var line = context.ReadLine();

            while (!line.Equals("."))
            {
                messageData.AddData(line);
                messageData.AddData("\r\n");
                line = context.ReadLine();
            }

            // Spool the message
            _handler(messageData.ParseMessage());
            context.WriteLine(MessageOk);

            // Reset the connection.
            context.Reset();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Reset the connection state.
 /// </summary>
 private static void Rset(SmtpContext context)
 {
     if (context.LastCommand != -1)
     {
         // Dump the message and reset the context.
         context.Reset();
         context.WriteLine(MessageOk);
     }
     else
     {
         context.WriteLine(MessageInvalidCommandOrder);
     }
 }
Ejemplo n.º 3
0
		private void Data(SmtpContext context)
		{
			context.WriteLine(MessageStartData);
			
			var messageData = context.MessageData;
			var clientEndPoint = (IPEndPoint) context.Socket.RemoteEndPoint;
			var header = new StringBuilder();
			header.Append(String.Format("Received: from {0} ({0} [{1}])\r\n", context.ClientDomain, clientEndPoint.Address));
			
			messageData.AddData(header.ToString());
			
			var line = context.ReadLine();
			while(!line.Equals("."))
			{
				messageData.AddData(line);
				messageData.AddData("\r\n");
				line = context.ReadLine();
			}

			// Spool the message
			_handler(messageData.ParseMessage());
			context.WriteLine(MessageOk);
			
			// Reset the connection.
			context.Reset();
		}
Ejemplo n.º 4
0
		/// <summary>
		/// Reset the connection state.
		/// </summary>
		private static void Rset(SmtpContext context)
		{
			if (context.LastCommand != -1)
			{
				// Dump the message and reset the context.
				context.Reset();
				context.WriteLine(MessageOk);
			}
			else
			{
				context.WriteLine(MessageInvalidCommandOrder);
			}
		}