Im sending the email when the form is submitted, but it isn working. Whats wrong?
There’s a race condition here where the form may be getting submitted before the email image is downloaded. Once the form submit starts, the thread that’s downloading the image is killed. So, to ensure that your attack always works, you should delay the form submission a little bit. You can use addEventListener with an event handler such as function(evt) { evt.preventDefault(); … }. In this way, you can prevent the form submission until you’re ready to trigger it yourself.