I have a simple function to email files (see code below). I've used it to send PDF reports in an application for a couple years. Recently it has been truncating the files without any error messages. The file is received with the email as an attachment, but the file sometimes has the end cut off. The reports are potentially larger than before. The cut off seems to be random (both the location in the file and whether it happens or not.)
Has anyone experienced anything like this? Is there something incorrect in my method?