Thank you for the PHP_EOL. I had problems on php 8.1.31 (or php 8.1 in general) where the previously working php's mail program (php 5.6, I believe) was causing unusual changes and the attachments were also not going through.
I had to change from '\n\n' to '\r\n' and then things started working smoothly. This change happened to go across many mail headers and most importantly the multipart-boundary and the multipart mixed
Wanted to publish this for future help to others