Пример #1
0
        private void Data(SMTPContext context)
        {
            context.WriteLine(MESSAGE_START_DATA);

            SMTPMessage   message        = context.Message;
            IPEndPoint    clientEndPoint = (IPEndPoint)context.Socket.RemoteEndPoint;
            StringBuilder header         = new StringBuilder();

            header.Append(String.Format("Received: from {0} ({0} [{1}])", context.ClientDomain, clientEndPoint.Address));
            header.Append("\r\n");
            header.Append(String.Format("     by {0} (Eric Daugherty's C# Email Server)", domain));
            header.Append("\r\n");
            header.Append("     " + System.DateTime.Now);
            header.Append("\r\n");

            message.AddData(header.ToString());

            String line = context.ReadLine();

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

            // Spool the message
            messageSpool.SpoolMessage(message);
            context.WriteLine(MESSAGE_OK);

            // Reset the connection.
            context.Reset();
        }
Пример #2
0
 /// <summary>
 /// Reset the connection state.
 /// </summary>
 private void Rset(SMTPContext context)
 {
     if (context.LastCommand != -1)
     {
         // Dump the message and reset the context.
         context.Reset();
         context.WriteLine(MESSAGE_OK);
     }
     else
     {
         context.WriteLine(MESSAGE_INVALID_COMMAND_ORDER);
     }
 }