the code was only needed if the page did not redirect to the thank you page.
since it is directing to the thank you page, it is trying to send the email to the SMTP Server, but the smtp server is refusing to relay the message.
who is you host?
What did you enter for the SMTP server in the UE settings
Send a link where i can see the form please.