Amavis alert BAD HEADER SECTION, MIME error on Delphi+Indy generated email

I wrote a Service app in Delphi 10 that sends emails (either with or without attachment).

I use Indy 10.6.2.

this is the main code that sends the email

with FdmMSThread do
  begin
// based on MailMessage.atachmentsCount set the conentytype
    if MailMessage.MessageParts.Count > 0 then
       MailMessage.ContentType := 'multipart/mixed'
       else
       MailMessage.ContentType := 'text/plain';
    MailMessage.CharSet := 'UTF-8';
    SMTP.Connect;
    SMTP.Send(MailMessage);
  end;

A customer reports that on his antivirus reports
X-Amavis-Alert: BADHEADER SECTION, MIME error:error: multipart boundary is missing, or contains CR or LF

All the headers are generated by Indy, and they should be fine, even because this application is in production since years.

I am not able to pinpoint the problem, could you please help? Where exactly the problem is?

I also tried to send a message to www.mail-tester.com but I got a score of 9/10, the only problem is related to the lack of a DKIM signature, but nothing about bad headers. So it seems to me that Amavis is quite picky.

What could be causing this error message?
How can I ensure that the multipart boundary in my emails is correctly formatted?

I paste here the full message, I hope you can help me.

Received: by mail-tester.com (Postfix, from userid 500)
    id 47088A0BC2; Fri, 31 May 2024 10:37:29 +0200 (CEST)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail-tester.com
X-Spam-Level: 
X-Spam-Status: No/0.0/5.0
X-Spam-Test-Scores: SPF_HELO_NONE=0.001,SPF_PASS=-0.001
X-Spam-Last-External-IP: 151.80.13.250
X-Spam-Last-External-HELO: mail.mycompany.com
X-Spam-Last-External-rDNS: mail.mycompany.com
X-Spam-Date-of-Scan: Fri, 31 May 2024 10:37:29 +0200
X-Spam-Report: 
    *  0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
    * -0.0 SPF_PASS SPF: sender matches SPF record
Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=151.80.13.250; helo=mail.mycompany.com; [email protected]; [email protected] 
DMARC-Filter: OpenDMARC Filter v1.3.1 mail-tester.com 5E01FA0BBB
Authentication-Results: mail-tester.com; dmarc=pass header.from=myproduct.com
Received: from mail.mycompany.com (mail.mycompany.com [151.80.13.250])
    (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits))
    (No client certificate requested)
    by mail-tester.com (Postfix) with ESMTPS id 5E01FA0BBB
    for <[email protected]>; Fri, 31 May 2024 10:37:26 +0200 (CEST)
Received: from localhost (localhost [127.0.0.1])
    by mail.mycompany.com (Postfix) with ESMTP id 16F0413B679
    for <[email protected]>; Fri, 31 May 2024 08:37:26 +0000 (UTC)
Received: from mail.mycompany.com ([127.0.0.1])
 by localhost (mail.mycompany.com [127.0.0.1]) (amavis, port 10032)
 with ESMTP id Cv-T4Nz7lWnh for <[email protected]>;
 Fri, 31 May 2024 08:37:25 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
    by mail.mycompany.com (Postfix) with ESMTP id E01E413B698
    for <[email protected]>; Fri, 31 May 2024 08:37:25 +0000 (UTC)
X-Virus-Scanned: amavis at mycompany.com
Received: from mail.mycompany.com ([127.0.0.1])
 by localhost (mail.mycompany.com [127.0.0.1]) (amavis, port 10026)
 with ESMTP id AoeOMfjMpxWI for <[email protected]>;
 Fri, 31 May 2024 08:37:25 +0000 (UTC)
Received: from sql (unknown [193.38.133.50])
    (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits))
    (No client certificate requested)
    by mail.mycompany.com (Postfix) with ESMTPSA id 6648113B679
    for <[email protected]>; Fri, 31 May 2024 08:37:25 +0000 (UTC)
From: "my self" <[email protected]>
Subject: P0401 Analisi del Contesto (Distribuzione Rev. 06)
To: [email protected]
Content-Type: multipart/mixed; charset=UTF-8; boundary="GY74iaF=_ueKJjxGVLnCDZedhRCs3hBylY"
MIME-Version: 1.0
Date: Fri, 31 May 2024 10:37:25 +0200
Message-Id: <[email protected]>

This is a multi-part message in MIME format

--GY74iaF=_ueKJjxGVLnCDZedhRCs3hBylY
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

THIS IS THE MESSAGE SUBJECT

-------------------------------------------------

This is the message body

-------------------------------------------------

--GY74iaF=_ueKJjxGVLnCDZedhRCs3hBylY
Content-Type: application/pdf;
    name="attachmentName.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
    filename="attachmentName.pdf"

JVBERi0xLjcNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu
ZyhpdC1JVCkgL1N0cnVjdFRyZWVSb290IDcwIDAgUi9NYXJrSW5mbzw8L01hcmtlZCB0cnVlPj4v
[...]
b3QgMSAwIFIvSW5mbyA4OTUgMCBSL0lEWzxDRTM4NTg4NkYxRUJFRjQzOUIxRjdFNEM3QzcxRkM5
Nz48Q0UzODU4ODZGMUVCRUY0MzlCMUY3RTRDN0M3MUZDOTc+XSAvUHJldiA2MDU2NjkvWFJlZlN0
bSA2MDM1MTM+Pg0Kc3RhcnR4cmVmDQo2MjQyMzANCiUlRU9G

--GY74iaF=_ueKJjxGVLnCDZedhRCs3hBylY--

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật