Пример #1
0
 public static IEmailClient CreateEmailClient( EmailServerInfo server, String username, String password )
 {
     if ( server==null )
         return null;
     switch ( server.Protocol ) {
         case ServerProtocol.Pop3:
             return new CTNSimplePOP3Client ( server.Host, server.Port, username, password );
         case ServerProtocol.Imap:
             return new SimpleIMAPClient( server.Host, server.Port, username, password );
     }
     return null;
 }
Пример #2
0
 public void Add( EmailServerInfo server )
 {
     if ( server==null || !server.IsValid() )
         throw new ArgumentNullException();
     this._servers.Add (server);
 }
Пример #3
0
 public static EmailServerInfo Parse( String value )
 {
     EmailServerInfo server = null;
     String[] values = value.ToString().Split(':');
     if ( values.Length==3 ) {
         ServerProtocol protocol = EmailServerInfo.ParseProtocol(values[0]);
         String host = EmailServerInfo.ParseHost(values[1]);
         int port = EmailServerInfo.ParsePort(values[2], protocol);
         if ( !protocol.Equals(ServerProtocol.Unknown) && port>0 && host!=null ) {
             server = new EmailServerInfo(protocol, host, port);
         }
     }
     return server;
 }