public bool Save(MailAddress to,Mail mail,MailInfo mailInfo) { if (mail.Append(to.ToString())) { if (_logger != null){ _logger.Set(LogKind.Normal, null, 21, string.Format("[{0}] {1}", to.User, mailInfo)); } } else { _logger.Set(LogKind.Error, null, 9000059, mail.GetLastError()); _logger.Set(LogKind.Error, null, 22, string.Format("[{0}] {1}", to.User, mailInfo)); } return true; }
public void AddSearchTest(string users, string searchUser, bool success) { //複数のユーザを追加 var ar = users.Split(new[]{','},StringSplitOptions.RemoveEmptyEntries); foreach (var user in ar) { var addr = new MailAddress(string.Format("{0}@example.com",user)); _mlSubscribeDb.Add(addr, user); } //検索アドレス var searchAddr = new MailAddress(searchUser, "example.com"); //検索実行 var o = _mlSubscribeDb.Search(searchAddr); if (success) {//成功の場合 Assert.AreEqual(o.MailAddress.ToString(), searchAddr.ToString()); } else {//失敗の場合 Assert.IsNull(o);//NULLが返る } }
public String Get(MailAddress to,String host,Ip addr) { //ユニークなID文字列の生成 var uidStr = string.Format("bjd.{0:D20}.{1:D3}", DateTime.Now.Ticks, _idCounter++); //日付文字列の生成 var date = Util.LocalTime2Str(DateTime.Now); var str = ""; if (_headerStr != null) { str = _headerStr; //Ver5.0.0-b5 $aと$hをkernel.ChangeTag()に送る前に修正する str = Util.SwapStr("$a", addr.ToString(), str); str = Util.SwapStr("$h", host, str); str = Util.SwapStr("$i", uidStr, str); str = Util.SwapStr("$t", to.ToString(), str); str = Util.SwapStr("$d", date, str); str = _kernel.ChangeTag(str); } return str; }