/// <summary> /// Is called when RCPT command has completed. /// </summary> /// <param name="op">Asynchronous operation.</param> /// <exception cref="ArgumentNullException">Is raised when <b>op</b> is null reference.</exception> private void RcptCommandCompleted(SMTP_Client.RcptToAsyncOP op) { if (op == null) { throw new ArgumentNullException("op"); } try{ if (op.Error != null) { Dispose(op.Error); } else { // Start sending message. SMTP_Client.SendMessageAsyncOP sendMsgOP = new SMTP_Client.SendMessageAsyncOP(m_pRelayItem.MessageStream, false); sendMsgOP.CompletedAsync += delegate(object s, EventArgs <SMTP_Client.SendMessageAsyncOP> e){ MessageSendingCompleted(sendMsgOP); }; if (!m_pSmtpClient.SendMessageAsync(sendMsgOP)) { MessageSendingCompleted(sendMsgOP); } } } catch (Exception x) { Dispose(x); } }
/// <summary> /// Is called when message sending has completed. /// </summary> /// <param name="op">Asynchronous operation.</param> /// <exception cref="ArgumentNullException">Is raised when <b>op</b> is null reference.</exception> private void MessageSendingCompleted(SMTP_Client.SendMessageAsyncOP op) { if (op == null) { throw new ArgumentNullException("op"); } try { if (op.Error != null) { Dispose(op.Error); } // Message sent sucessfully. else { Dispose(null); } } catch (Exception x) { Dispose(x); } op.Dispose(); }
/// <summary> /// Is called when RCPT command has completed. /// </summary> /// <param name="op">Asynchronous operation.</param> /// <exception cref="ArgumentNullException">Is raised when <b>op</b> is null reference.</exception> private void RcptCommandCompleted(SMTP_Client.RcptToAsyncOP op) { if(op == null){ throw new ArgumentNullException("op"); } try{ if(op.Error != null){ Dispose(op.Error); } else{ // Start sending message. SMTP_Client.SendMessageAsyncOP sendMsgOP = new SMTP_Client.SendMessageAsyncOP(m_pRelayItem.MessageStream,false); sendMsgOP.CompletedAsync += delegate(object s,EventArgs<SMTP_Client.SendMessageAsyncOP> e){ MessageSendingCompleted(sendMsgOP); }; if(!m_pSmtpClient.SendMessageAsync(sendMsgOP)){ MessageSendingCompleted(sendMsgOP); } } } catch(Exception x){ Dispose(x); } }