It's exactly the same code as in the test file so there is no reason why one would work and the other not.
Did you try with the same e-mail address as the one you used in the test file?
Is the "Noreply" e-mail address is Hesk settings a valid one?
Have you checked your SPAM box? You can also try adding Hesk noreply address to the SPAM filter whitelist.
Try submitting a ticket using an e-mail address that is under the same domain name as you Have hesk installed. For example if you have Hesk at
www.yourdomain.com/support try submitting a ticket using
something@yourdomain.com