I haven't been able to find any reason for this behaviour. The oddest thing is that it works when you click to download manually, but not when it attempts to email the CSV file.
The only difference between the two methods is that the emailing saves a temporary copy of the CSV file to your server's tmp directory. Perhaps the server isn't allowing this to be accessed?
If the same exact code works on one host, but not another, then it has to be some kind of server setting that's causing the problem.
In the next week or so, I'll make some changes and see if they affect anything in relation to where it saves the CSV file temporarily.