public static string ParseAddress(string p,bool allowBroadcast)
{
p = p.Replace("<", "").Replace(">", "").Trim();
if (!p.ToLower().Contains("@" + DOMAIN))
{
return null;
}
if(p.Contains(" "))
{
p = p.Substring(p.LastIndexOf(' ') + 1);
}
if (p.ToUpper().StartsWith(BROADCAST + "@"))
{
return allowBroadcast ? BROADCAST : null;
}
if (p.ToUpper().StartsWith(ADDRESS + "@"))
{
return allowBroadcast ? ADDRESS : null;
}
if (p.StartsWith("BM-"))
{
return p.Split('@')[0];
}
else
{
return null;
}
}