Fixed non-RFC-compliant handling of lines starting with dots
[mgsmtp.git] / Relay.pas
index 4984bc1ea5bf04fb6b427a5bfce48c3c77ee74fb..1e42979d761b9401daa8cbd342b45dc326330b76 100644 (file)
--- a/Relay.pas
+++ b/Relay.pas
@@ -474,7 +474,14 @@ end;
 
 function TRelayer.DeliverMessagePart(Chunk: TStrings): boolean;
 { Sends a chunk of the message. }
 
 function TRelayer.DeliverMessagePart(Chunk: TStrings): boolean;
 { Sends a chunk of the message. }
+var i: integer;
 begin
 begin
+   { Check for lines starting with dots. }
+   for i:= 0 to Chunk.Count - 1 do
+      if (Length(Chunk.Strings[i]) > 0) and (Chunk.Strings[i][1] = '.') then
+         Chunk.Strings[i]:= '.' + Chunk.Strings[i];
+
+   { Send text. }
    Result:= TCP.WriteBuffer(PChar(Chunk.Text), Length(Chunk.Text)) <> -1;
 end;
 
    Result:= TCP.WriteBuffer(PChar(Chunk.Text), Length(Chunk.Text)) <> -1;
 end;