I came across an issue when I was trying to manipulate a file which I had just emailed using the standard email code which is on multiple places on the web.
All descriptions on the web (that I have seen) which show how to do this so far have left the email attachment open which means if the script is continuing after the email and you wish to use the file you have attached you will not be able to as it will show as locked, use this example to close the attached file correctly using .Dispose()
Thanks to Jaykul on the Powershell IRC channel.
No problem, I think most people send the email as the last thing with the results, its only because I needed to work with the file that I found this out.
Glad it helped someone else !
Thanks for posting that. I looked everywhere for this. Like you said almost all the examples left the attachment locked.