Cleaned & Hardened Email.cs
This commit is contained in:
@@ -1,29 +1,47 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
namespace smtpproxy.net;
|
|
||||||
|
namespace smtpproxy.net
|
||||||
public class Email
|
{
|
||||||
{
|
public class Email
|
||||||
public string FromIP;
|
{
|
||||||
|
public string FromIP { get; set; }
|
||||||
public string sHELO;
|
public string sHELO { get; set; }
|
||||||
|
public string sMAIL { get; set; }
|
||||||
public string sMAIL;
|
public string sDATA { get; set; }
|
||||||
|
public List<string> sRCPTs { get; set; }
|
||||||
public string sDATA;
|
|
||||||
|
public Email()
|
||||||
public List<string> sRCPTs;
|
{
|
||||||
|
FromIP = string.Empty;
|
||||||
public string GetRecipientEmail(string sRCPTTo)
|
sHELO = string.Empty;
|
||||||
{
|
sMAIL = string.Empty;
|
||||||
return sRCPTTo.ToLower().Replace("rcpt to:", "").Replace("<", "")
|
sDATA = string.Empty;
|
||||||
.Replace(">", "")
|
sRCPTs = new List<string>();
|
||||||
.Replace("\r", "")
|
}
|
||||||
.Replace("\n", "");
|
|
||||||
}
|
public string GetRecipientEmail(string sRCPTTo)
|
||||||
|
{
|
||||||
public Email()
|
if (string.IsNullOrEmpty(sRCPTTo))
|
||||||
{
|
return string.Empty;
|
||||||
sRCPTs = new List<string>();
|
|
||||||
}
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user