1

I know that in order to fix the error "File attachment or query results size exceeds allowable value of 1000000 bytes" we need to configure the Database Mail to increase the attachment size.

But here my problem is, my file size is 998 KB (so 2 KB less than allowed size). But I still get this error. Note: my file is of type .xlsm.

It looks like I have no other option but to increase the attachment size but is this how it works? Is it a known bug?

Sri
  • 11
  • 2
  • Does this answer your question? [Base64: What is the worst possible increase in space usage?](https://stackoverflow.com/questions/4715415/base64-what-is-the-worst-possible-increase-in-space-usage) – Ken Y-N Sep 24 '20 at 01:45
  • File attachments get encoded as base64, so there is a 33% increase in attachment size due to this, so your actual maximum attachment size is closer to 750KB. If the data is all ASCII, you could post as body text and avoid the base64 encoding, perhaps? – Ken Y-N Sep 24 '20 at 01:47

1 Answers1

1

I suspect that the KB in your file size is 1024 bytes, not 1000 bytes.

So, 998 KB = 1,021,952 bytes.

And regardless of the discrepancy...the answer is: Yes, you need to increase the attachment size limit. I would not try to make that limit overly precise. If you're typically shipping 1 MB files, set the limit to 10 MB. That will still block the 2 GB WTF files...but it won't die when someone needs to send a big annual report instead of the smaller monthly report.

David Hempy
  • 5,373
  • 2
  • 40
  • 68