47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace smtpproxy.net
|
|
{
|
|
public class Email
|
|
{
|
|
public string FromIP { get; set; }
|
|
public string sHELO { get; set; }
|
|
public string sMAIL { get; set; }
|
|
public string sDATA { get; set; }
|
|
public List<string> sRCPTs { get; set; }
|
|
|
|
public Email()
|
|
{
|
|
FromIP = string.Empty;
|
|
sHELO = string.Empty;
|
|
sMAIL = string.Empty;
|
|
sDATA = string.Empty;
|
|
sRCPTs = new List<string>();
|
|
}
|
|
|
|
public string GetRecipientEmail(string sRCPTTo)
|
|
{
|
|
if (string.IsNullOrEmpty(sRCPTTo))
|
|
return string.Empty;
|
|
|
|
string cleaned = sRCPTTo
|
|
.Replace("\r", "")
|
|
.Replace("\n", "")
|
|
.Replace("<", "")
|
|
.Replace(">", "")
|
|
.Trim();
|
|
|
|
if (cleaned.StartsWith("rcpt to:", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
cleaned = cleaned.Substring(8).Trim();
|
|
}
|
|
else if (cleaned.StartsWith("rcpt to", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
cleaned = cleaned.Substring(7).Trim();
|
|
}
|
|
|
|
return cleaned.ToLowerInvariant();
|
|
}
|
|
}
|
|
} |