dotnet-core_mail-server/MailServer/SMTPServer/SmtpCommand.cs
2016-12-09 15:41:35 +01:00

46 lines
1.0 KiB
C#

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(""))
{
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];
}
}
}
}