Esempio n. 1
0
        private void Data(SMTPContext context)
        {
            context.WriteLine(Resources.Protocol_MESSAGE_START_DATA__354_Start_mail_input_end_with_CRLF_CRLF);

            SMTPMessage message = context.Message;
            var clientEndPoint = (IPEndPoint)context.Socket.RemoteEndPoint;
            var header = new StringBuilder();
            header.AppendFormat(Resources.EMAIL_Received_from_0_0_1, context.ClientDomain, clientEndPoint.Address);
            header.AppendLine();
            header.AppendFormat(Resources.EMAIL_by_0_Eric_Daugherty_s_C_Email_Server, _domain);
            header.AppendLine();
            header.Append("     " + DateTime.Now);
            header.AppendLine();

            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(Resources.Protocol_MESSAGE_OK_250_OK);

            // Reset the connection.
            context.Reset();
        }
Esempio 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(Resources.Protocol_MESSAGE_OK_250_OK);
     }
     else
     {
         context.WriteLine(Resources.Protocol_MESSAGE_INVALID_COMMAND_ORDER_503_Command_not_allowed_here);
     }
 }