<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Hi,</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Am 19.11.2024 um 21:25 schrieb duilio
foschi via lazarus:<br>
</div>
<blockquote type="cite"
cite="mid:CABkiRz8_gkN=70H7T3KsK4jow-UKUTfEwjuZ71pSig3PMUdMUg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">I cannot understand how I can post a message into a
newsgroup using INet<br>
components.<br>
</div>
</blockquote>
<p>I am not 100% sure but as far as I remember you need to send a
single "POST" command first check the return code if you are even
allowed to post</p>
<p>and then sent the Header and Content<br>
</p>
<blockquote type="cite"
cite="mid:CABkiRz8_gkN=70H7T3KsK4jow-UKUTfEwjuZ71pSig3PMUdMUg@mail.gmail.com">
<div dir="ltr">uses
<div>...lNet, lclnet, lnetcomponents, LConvEncoding;<br>
<div><br>
</div>
<div>var<br>
aStream:TMemoryStream; // correctly initialized
elsewhere<br>
aclient:TLTCPComponent; // correctly initialized
elsewhere<br>
<br>
procedure LineToStream(Buf : String);<br>
begin<br>
Buf := Buf + #13#10;<br>
aStream.WriteBuffer(Buf[1], Length(Buf));<br>
end;<br>
<br>
procedure TfrmUReader.btnSendPostClick(Sender: TObject);<br>
var<br>
a:integer;<br>
begin<br>
aStream.Clear;<br>
LineToStream('POST');<br>
</div>
</div>
</div>
</blockquote>
<p> aStream.Position := 0;</p>
<p> a:=aclient.Send(aStream, aStream.Size);</p>
<p> if a = 340 then</p>
<p> begin</p>
<p> aStream.Clear;</p>
<blockquote type="cite"
cite="mid:CABkiRz8_gkN=70H7T3KsK4jow-UKUTfEwjuZ71pSig3PMUdMUg@mail.gmail.com">
<div dir="ltr">
<div>
<div> LineToStream('"peppepolpo" <<a
href="mailto:octopushole@gmail.com" moz-do-not-send="true"
class="moz-txt-link-freetext">octopushole@gmail.com</a>>');<br>
LineToStream('Newsgroups: it.hobby.fai-da-te');<br>
LineToStream('Subject: test 201937');<br>
LineToStream('Organization: None');<br>
LineToStream('X-Newsreader: DIY component ');<br>
<br>
{ End of header is a blank line }<br>
LineToStream('');<br>
<br>
{ Write the message body }<br>
LineToStream('');<br>
LineToStream('test 201937');<br>
</div>
</div>
</div>
</blockquote>
LineToStream('.'); // End the message with a single point<br>
<blockquote type="cite"
cite="mid:CABkiRz8_gkN=70H7T3KsK4jow-UKUTfEwjuZ71pSig3PMUdMUg@mail.gmail.com">
<div dir="ltr">
<div>
<div><br>
<br>
aStream.Seek(0, soFromBeginning );<br>
<br>
a:=aclient.Send(aStream, aStream.Size);<br>
<br>
// a=500 here<br>
end;</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>