add ProxyJump function
This commit is contained in:
1 parent
56e20e5464
commit
7f0e0fdb23
48 files changed
+3875
-44
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace BulkArchiveMailer.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Derives the recipient's email address from the login embedded in an
|
||||
/// archive file name. Rule (see repo README/plan, confirmed with the
|
||||
/// operator): a Linux login such as "a-makarov" maps to
|
||||
/// "a.makarov@<domain>" by replacing every hyphen with a dot -
|
||||
/// there is no separate mapping table.
|
||||
///
|
||||
/// Known accepted limitation (do NOT try to fix this with an override
|
||||
/// mechanism): if a real login contains a literal hyphen that is not
|
||||
/// an initial/surname separator, this produces the wrong local part.
|
||||
/// That is out of scope for this tool - see README.md.
|
||||
/// </summary>
|
||||
public static class EmailAddressBuilder
|
||||
{
|
||||
public static string BuildEmail(string login, string domain)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(login))
|
||||
{
|
||||
throw new ArgumentException("login must not be empty.", nameof(login));
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(domain))
|
||||
{
|
||||
throw new ArgumentException("domain must not be empty.", nameof(domain));
|
||||
}
|
||||
|
||||
var localPart = login.Trim().ToLowerInvariant().Replace('-', '.');
|
||||
var cleanDomain = domain.Trim().TrimStart('@');
|
||||
return $"{localPart}@{cleanDomain}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user