Fixed non-RFC-compliant handling of lines starting with dots
[mgsmtp.git] / Listener.pas
index a4d94f0516b36344c8ea6b80b89a235a5fdede93..b37662b15302704304dfaa0ad059ea99ab4337ec 100644 (file)
@@ -507,8 +507,11 @@ begin
       Done:= false;
       repeat
          ReadOK:= TCP.ReadLn(Line);
-         if Line <> '.' then
-            SpoolObject.DeliverMessagePart(Line)
+         if Line <> '.' then begin
+            { If the line starts with a dot, remove it to comply with RFC. }
+            if (Length(Line) > 1) and (Line[1] = '.') then Delete(Line, 1, 1);
+            SpoolObject.DeliverMessagePart(Line);
+         end
          else
             Done:= true;
       until Done or (not ReadOK);