Topic Path: Symbol Reference > Classes > TIdNNTP Class > TIdNNTP Methods > Post Method > Post Method (TIdMessage)
TIdNNTP.Post Method (TIdMessage)

Transmits a new article to the NNTP server.

procedure Post(
    AMsg: TIdMessage
); overload;
Message instance 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 AMsg is used as the source for message data, Post will ensure that the TIdMessage.ExtraHeaders property contains the value of Newsagent in the 'X-Newsreader' message header. The TIdMessage in AMsg is sent to the server using SendMsg, followed by the terminating CRLF.CRLF required to signal the end of message data and transmission. 

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);
Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.