'trouble sending email with attachment programmatically in IIS

I have an IIS website on Windows Server 2019 that uses binary executables (EXE's) on the back end. One of those programs creates a PDF (around 19k in size), then emails the PDF. The emailing is done using a 3rd party DLL (sockettools) which sends using a Gmail address (as opposed to using SMTP in IIS). The email sends as expected, the PDF is attached, but the PDF is always 0 bytes. I've written a sample EXE using the same library and when I run it from the console in the CGI directory on the IIS server, it runs correctly (email sends and PDF's are intact). This seems like a permissions issue to me but I can't figure out what IIS wants.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source