Hi welcome to CodeRanch :-)
First, when you post code can you please use code tags? You can use the by putting [
code][
/code] tags around the code, or by using the
Code button at the top of the message form. The code tags make it a lot easier to read your code. You can go ahead and add the code tags back into the message now using the

button.
To your question. It looks like if you add the following line to your code, prior to sending the message, it works.