示例#1
0
    public static void Main(string[] args)
    {
        ImapConnection.ServerCertificateValidationCallback += delegate {
          // 適切な証明書の検証を行うように書き換えてください
          return true;
        };

        using (var client = new ImapClient(new Uri("imap://[email protected]/"))) {
          client.Connect("pass");

          Console.WriteLine("connected!!");
        }
    }
示例#2
0
        public void TestConnectBeginConnectRunning()
        {
            using (var server = new ImapPseudoServer()) {
            server.Start();

            using (var client = new ImapClient(server.Host, server.Port, "user")) {
              client.BeginConnect("pass");

              try {
            client.Connect("pass");
            Assert.Fail("InvalidOperationException not thrown");
              }
              catch (InvalidOperationException) {
              }

              try {
            client.Connect(new NetworkCredential("user", "pass"));
            Assert.Fail("InvalidOperationException not thrown");
              }
              catch (InvalidOperationException) {
              }
            }
              }
        }