/// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="replyLines">SMTP server error reply lines.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>replyLines</b> is null reference.</exception>
        public SMTP_ClientException(SMTP_t_ReplyLine[] replyLines) : base(replyLines[0].ToString().TrimEnd())
        {
            if(replyLines == null){
                throw new ArgumentNullException("replyLines");
            }

            m_pReplyLines = replyLines;            
        }
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="responseLine">SMTP server response line.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>responseLine</b> is null.</exception>
        public SMTP_ClientException(string responseLine) : base(responseLine.TrimEnd())
        {
            if (responseLine == null)
            {
                throw new ArgumentNullException("responseLine");
            }

            m_pReplyLines = new SMTP_t_ReplyLine[] { SMTP_t_ReplyLine.Parse(responseLine) };
        }
Example #3
0
 /// <summary>
 /// Sends specified final response to client.
 /// </summary>
 /// <param name="reply">SMTP reply.</param>
 private void SendFinalResponse(SMTP_t_ReplyLine reply)
 {
     try{
         if(reply == null){
             throw new ArgumentNullException("reply");
         }
        
         SMTP_Session.SendResponseAsyncOP sendResponseOP = new SendResponseAsyncOP(reply);
         sendResponseOP.CompletedAsync += delegate(object sender,EventArgs<SendResponseAsyncOP> e){
             SendFinalResponseCompleted(sendResponseOP);
         };
         if(!m_pSession.SendResponseAsync(sendResponseOP)){
             SendFinalResponseCompleted(sendResponseOP);
         }                    
     }
     catch(Exception x){
         m_pException = x;
         m_pSession.LogAddException("Exception: " + m_pException.Message,m_pException);
         SetState(AsyncOP_State.Completed);
     }
 }
Example #4
0
            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="replyLines">SMTP server reply lines.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>replyLines</b> is null reference.</exception>
            /// <exception cref="ArgumentException">Is raised when any of the arguments has invalid values.</exception>
            public SendResponseAsyncOP(SMTP_t_ReplyLine[] replyLines)
            {
                if(replyLines == null){
                    throw new ArgumentNullException("replyLines");
                }
                if(replyLines.Length < 1){
                    throw new ArgumentException("Argument 'replyLines' must contain at least 1 item.","replyLines");
                }

                m_pReplyLines = replyLines;
            }
Example #5
0
            /// <summary>
            /// Default constructor.
            /// </summary>
            /// <param name="reply">SMTP server reply line.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>reply</b> is null reference.</exception>
            public SendResponseAsyncOP(SMTP_t_ReplyLine reply)
            {
                if(reply == null){
                    throw new ArgumentNullException("reply");
                }

                m_pReplyLines = new SMTP_t_ReplyLine[]{reply};
            }