예제 #1
0
  }//public static int ResponseCheck

  /// <summary>SendList</summary>
  public static void SendList
  (
   ref NetworkStream  networkStream,
   ref StringBuilder  sbResponse,
   ref int            responseCheckFlag,
   ref String         exceptionMessage
  )
  {

   UtilityTcpIp.Write
   (
    ref networkStream,
    ref MessageList,
    ref exceptionMessage
   );

   UtilityTcpIp.Read
   (
    ref networkStream,
    ref sbResponse,
    ref exceptionMessage
   );

   ResponseCheck
   ( 
    ref sbResponse,
    ref responseCheckFlag
   );

  }//public static void SendList
예제 #2
0
  }//public static void SendUser

  /// <summary>SendQuit</summary>
  public static void SendQuit
  (
   ref NetworkStream  networkStream,
   ref StringBuilder  sbResponse,
   ref int            responseCheckFlag,
   ref String         exceptionMessage
  )
  {

   UtilityTcpIp.Write
   (
    ref networkStream,
    ref MessageQuit,
    ref exceptionMessage
   );

  }//public static void SendQuit
예제 #3
0
  }//public static void SendList

  /// <summary>SendPassword</summary>
  public static void SendPassword
  (
   ref NetworkStream  networkStream,
   ref String         password,
   ref StringBuilder  sbResponse,
   ref int            responseCheckFlag,
   ref String         exceptionMessage
  )
  {
   String  message  =  null;

   message = String.Format( MessagePassword, password);

   UtilityTcpIp.Write
   (
    ref networkStream,
    ref message,
    ref exceptionMessage
   );

   /*
   UtilityTcpIp.Read
   (
    ref networkStream,
    ref sbResponse,
    ref exceptionMessage
   );

   ResponseCheck
   ( 
    ref sbResponse,
    ref responseCheckFlag
   );

   */

  }//public static void SendPassword
예제 #4
0
  }//public static void MailReceive()

  ///<summary>MailReceive.</summary>
  public static void MailReceive
  (
   ref String    serverNamePOP3,
   ref int       port,
   ref String    username,
   ref String    password,
   ref String    exceptionMessage
  )
  {

   int             responseCheckFlag  =  -1;
   HttpContext     httpContext        =  HttpContext.Current;
   NetworkStream   networkStream      =  null;
   StringBuilder   sbResponse         =  null;
   TcpClient       tcpClient          =  null;

   try
   {
    UtilityTcpIp.TcpClient
    (
     ref serverNamePOP3,
     ref port,
     ref tcpClient,
     ref exceptionMessage
    );

    networkStream = tcpClient.GetStream();

    //Connect
    UtilityTcpIp.Read
    (
     ref networkStream,
     ref sbResponse,
     ref exceptionMessage
    );

    ResponseCheck
    ( 
     ref sbResponse,
     ref responseCheckFlag
    );

    if ( responseCheckFlag != 0 )
    {
     return;
    }//if ( responseCheckFlag != 0 )

    SendUser
    (
     ref networkStream,
     ref username,
     ref sbResponse,
     ref responseCheckFlag,
     ref exceptionMessage
    );

    /*
    if ( responseCheckFlag != 0 )
    {
     return;
    }//if ( responseCheckFlag != 0 )
    */

    SendPassword
    (
     ref networkStream,
     ref password,
     ref sbResponse,
     ref responseCheckFlag,
     ref exceptionMessage
    );

    /*
    if ( responseCheckFlag != 0 )
    {
     return;
    }//if ( responseCheckFlag != 0 )
    */

    SendList
    (
     ref networkStream,
     ref sbResponse,
     ref responseCheckFlag,
     ref exceptionMessage
    );

    /*
    if ( responseCheckFlag != 0 )
    {
     return;
    }//if ( responseCheckFlag != 0 )
    */
  
    SendQuit
    (
     ref networkStream,
     ref sbResponse,
     ref responseCheckFlag,
     ref exceptionMessage
    );

   }//try
   catch( SocketException exception )
   {
    exceptionMessage = "SocketException: " + exception.Message;
   }   	
   catch( System.Web.HttpException exception )
   {
    exceptionMessage = "HttpException: " + exception.Message;
   }   	
   catch ( Exception exception )
   {
    exceptionMessage = "Exception: " + exception.Message;
   }//catch ( Exception exception )
   
   if ( exceptionMessage != null )
   {
    if ( httpContext == null )
    {
     System.Console.WriteLine( exceptionMessage );
    }//if ( httpContext == null )
    else
    {
     httpContext.Response.Write( exceptionMessage );
    }//else 
   }//if ( exceptionMessage != null )

   if ( tcpClient != null )
   {
    tcpClient.Close();
   }//if ( tcpClient != null )

  }//public static void MailReceive