MAIL FROM:<disdtesthq1@mmhs.uk> SIZE=5754 ENVID=X400-MTS-Identifier:+20[/PRMD+3dFirst+20Organizati/ADMD+3d+20/C+3dGB/;DC01-140416101643Z-98] RET=FULL
I have created an extension to handle the ENVID and RET parameters, however when the verb is parsed, the ENVID parameter is read in as "ENVID=X400-MTS-Identifier" and the remainder handled as an additional parameter. According to RFC 3461, ':' is a valid character for the ENVID parameter, however it is not treated as such.
Comments: ** Comment from web user: wolfeyes **
Updating SmtpCommand.ParseArguments() as follows will resolve the issue for the colon character being used within a parameter vaue.
private string[] ParseArguments(string argumentsText)
{
int ltCount = 0;
bool colonSeparatorFound = false;
List<string> arguments = new List<string>();
StringBuilder currentArgument = new StringBuilder();
foreach (char character in argumentsText)
{
switch (character)
{
case '<':
ltCount++;
goto default;
case '>':
ltCount--;
goto default;
case ' ':
case ':':
if (ltCount == 0 && !colonSeparatorFound)
{
arguments.Add(currentArgument.ToString());
currentArgument = new StringBuilder();
colonSeparatorFound = true;
}
else
{
goto default;
}
break;
default:
currentArgument.Append(character);
break;
}
}
if (currentArgument.Length != 0)
{
arguments.Add(currentArgument.ToString());
}
return arguments.ToArray();
}