dotnet-core_mail-server/MailServer/SMTPServer/SmtpCommand.cs

46 lines
1.0 KiB
C#
Raw Permalink Normal View History

2016-11-27 17:38:47 +00:00
using System;
using System.Collections.Generic;
using System.Text;
namespace MailServer.SMTPServer
{
public class SmtpCommand
{
public string Command { get; set; }
public string[] Parameters { get; set; }
public SmtpCommand(string command)
{
Parameters = new string[0];
if (command.Length == 0 || command.Equals(""))
2016-11-27 17:38:47 +00:00
{
Command = "FREELINE";
return;
}
else if (command.Equals("."))
{
Command = "JUSTADOT";
return;
}
# if DEBUG
else if (command.Equals("<CRLF>.<CRLF>"))
{
Command = "DATAEND";
return;
}
# endif
var sp = command.Split(' ');
Command = sp[0];
if (sp.Length < 2) return;
Parameters = new string[sp.Length - 1];
for (int i = 1; i < sp.Length; i++)
{
Parameters[i - 1] = sp[i];
}
}
}
}