Hello MrHoffman,
I was trying to clarify the issue I'm facing that it was not specific to CSV files, nor it was related to how line feed was handled on macOS vs other systems even though those information would be helpful for someone encountered CSV file attachment related issues. I was not dealing with Excel or other Microsoft software at all.
When I discovered this problem I was just trying to send a plain txt file attachment as shown in my previous message. And the receiving party kept reporting MD5 mismatch on the file. My initial reaction was actually along the line of some line feed conversion issues across different systems.
But incidentally when I tried using other mail client (web mail interface) this issue did not happen, then I started looking into search Mail related issues and found at least there was one message thread related to this dated back to 2009 https://discussions.apple.com/thread/2235362 and there was no resolution in the end. In that thread, there were detailed discussions about the file attachment in the outgoing mail suggesting wrong handling by Mail which I'm not an expert in that area to comment on.
You brought up a very interesting point in your message that the mail server in the middle could be in the play. So I did a quick test by using my Yahoo email account to send a email with this mail-test.txt file attachment.
First I composed the email in Safari using Yahoo email web page interface, the downloaded mail-test.txt was exactly same as the original file. Then I used Apple Mail to compose the email with the same Yahoo email account (of course, the smtp/pops for the Yahoo account needs to be setup in Mail), but this time the downloaded file had the extra 0x0D in there. It appears this test still point to Mail had something to do with it.
Although it may not be conclusive as each email sent may hop through different servers, but so far all the text attachment emails (>10) sent via Mail all showed this issue. Other web mail clients (Gmail & Yahoo) I've tried (>10) with the same text file attachment would reach destination exactly the same.
Will you be able to do a quick test?
<I wish there is a way I can attach my mail-test.txt to the message which would make things much easier for the test>
- Compose a text file with 3 lines.
- Check it has 0x0D, 0x0A at the end of each line in a hex editor.
- Send an email with this text file as an attachment to another email account.
- Check the received file at the other email account whether you see extra blank lines in between/extra 0x0D in hex editor.
I'd like to find out if it is a real problem with Mail that can be replicated or some other factors cause this issue (such as the Mail version I'm using etc).