[Lazarus] help with NNTP posting
duilio foschi
octopushole at gmail.com
Tue Nov 19 21:25:20 CET 2024
I cannot understand how I can post a message into a newsgroup using INet
components.
I can connect, authenticate, join a group and issue several commands like
ARTICLE
BODY
HEAD
XOVER
However, when I try to post a message, my code always returns 500 (unknown
command or wrong syntax).
Any help?
This is what I do (after connecting and authenticating):
uses
...lNet, lclnet, lnetcomponents, LConvEncoding;
var
aStream:TMemoryStream; // correctly initialized elsewhere
aclient:TLTCPComponent; // correctly initialized elsewhere
procedure LineToStream(Buf : String);
begin
Buf := Buf + #13#10;
aStream.WriteBuffer(Buf[1], Length(Buf));
end;
procedure TfrmUReader.btnSendPostClick(Sender: TObject);
var
a:integer;
begin
aStream.Clear;
LineToStream('POST');
LineToStream('"peppepolpo" <octopushole at gmail.com>');
LineToStream('Newsgroups: it.hobby.fai-da-te');
LineToStream('Subject: test 201937');
LineToStream('Organization: None');
LineToStream('X-Newsreader: DIY component ');
{ End of header is a blank line }
LineToStream('');
{ Write the message body }
LineToStream('');
LineToStream('test 201937');
aStream.Seek(0, soFromBeginning );
a:=aclient.Send(aStream, aStream.Size);
// a=500 here
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20241119/2fcb211b/attachment.htm>
More information about the lazarus
mailing list