internal static MailTool New(string host, int port, bool enableSsl, string account, string password) { MailTool result; string key = string.Concat(host.Trim(), port, enableSsl, account.Trim(), password.Trim()).ToLower(); if (!sClients.TryGetValue(key, out result)) { lock (sClientLock) { if (!sClients.TryGetValue(key, out result)) { result = new MailTool(host, port, enableSsl, account, password); sClients.TryAdd(key, result); } } } return(result); }
public static MailTool Mail(string host, int port, string account, string password, bool enableSsl = false) { return(MailTool.New(host, port, enableSsl, account, password)); }