Internet Direct (Indy)
Home
PreviousUpNext
TIdNNTP.Post Method (TIdStream)

Transmits a new article to the NNTP server.

Pascal
procedure Post(
    AStream: TIdStream
); overload;
Parameters 
Description 
AStream 
Stream containing the message to be sent to the NNTP server. 

Post is an overloaded procedure in TIdNNTP that allows the NNTP client to send a new article to the NNTP server. The overloaded methods can use either the TIdMessage in AMsg or the contents in the stream identified by AStream as the origin of the message content. 

Post sends message content presented in the format specified by RFC 1036, including required header and body lines for the message, using the conventions required for the NNTP protocol. 

Post calls SendCmd using the NNTP POST command to request a posting transaction on the the NNTP server. When the numeric response code from the server is 440, posting is prohibited on the server or newsgroup. When the server response is 340, posting is allowed on the newsgroup. When posting is allowed, Post will send message data using the AMsg or AStream argument provided to the method. 

When AStream is used as the source for message data, Post will send the content of the stream to the server using WriteStream. The terminating CRLF.CRLF required to signal the end of message data and transmission is sent folowing message data. Note: When using a stream to post a message, it is assumed that the stream contains all required message headers and message body for the NNTP article. 

Numeric response code 240 in LastCmdResult indicates that the article was successfully posted to the NNTP server.

(Delphi) Posting a newsgroup message using TIdMessage. 

 

IdMessage1.Subject := sSubject;
IdMessage1.Body.Text := sBody;

if IdNNTP1.Connected then IdNNTP1.Post(IdMessage1);

(Delphi) Posting a newsgroup message using an Indy Stream. 

 

// AStream: TIdStreamVCL... content created manually
AStream.Position := 0;
if IdNNTP1.Connected then IdNNTP1.Post(AStream);
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.