// We create nntp client object.

NntpClient nntp = new NntpClient();

 

try

{

    // We connect to the nntp server.

    nntp.Connect(_tbNntpServer.Text);

 

    // We create the message to post.

    Message msg = new Message();

    msg.Subject = _tbSubject.Text;

    msg.BodyText.Text = _tbBody.Text;

    msg.To.Add(_tbNewsgroup.Text);

    nntp.Post(msg); 

}

 

catch (NntpException pexp)

{

    this.AddLogEntry(string.Format("Nntp Error: {0}", pexp.Message));

}

 

catch (Exception ex)

{

    this.AddLogEntry(string.Format("Failed: {0}", ex.Message));

}

 

finally

{

    if (nntp.IsConnected)

    {

        nntp.Disconnect(); ;

    }

}