G
Guest
Hello,
I'm developing a windows service that monitors a directory (using a
FileSystemWatcher) for newly created files. When a new file is created, I
need to generate an e-mail and send that file as an attachment. This all
working fine except that sometimes the code that adds the attachment fires
before the new file is finished being written to, resulting in an "invalid
mail attachment" error.
What is the best way to deal with this? Is there some way to determine if a
file is not being accessed before trying to attach it? Should I find some way
to delay the attachment by a few seconds? Thanks in advance for your help!
Brian
I'm developing a windows service that monitors a directory (using a
FileSystemWatcher) for newly created files. When a new file is created, I
need to generate an e-mail and send that file as an attachment. This all
working fine except that sometimes the code that adds the attachment fires
before the new file is finished being written to, resulting in an "invalid
mail attachment" error.
What is the best way to deal with this? Is there some way to determine if a
file is not being accessed before trying to attach it? Should I find some way
to delay the attachment by a few seconds? Thanks in advance for your help!
Brian