Exemplo n.º 1
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);
     }
 }
Exemplo n.º 2
0
        private void Data(SMTPContext context)
        {
            context.WriteLine(MESSAGE_START_DATA);

            IPEndPoint    clientEndPoint = (IPEndPoint)context.Socket.RemoteEndPoint;
            StringBuilder data           = new StringBuilder();

            data.Append(String.Format("Received: from {0} ({0} [{1}])", context.ClientDomain, clientEndPoint.Address));
            data.Append("\r\n");
            data.Append(String.Format("     by {0} (Age of Wonders Email Wrapper)", domain));
            data.Append("\r\n");
            data.Append("     " + System.DateTime.Now);
            data.Append("\r\n");

            String line = context.ReadLine();

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

            context.Message = new MailBuilder().CreateFromEml(data.ToString());

            // Spool the message
            if (messageSpool == null)
            {
                //If no spooler set
                context.WriteLine(MESSAGE_OK);
            }
            else if (messageSpool.SpoolMessage(context.Message))
            {
                context.WriteLine(MESSAGE_OK);
            }
            else
            {
                context.WriteLine(MESSAGE_SYSTEM_ERROR);
            }

            // Reset the connection.
            context.Reset();
        }