I just set up an email form for my dads website. For some reasons no message arrives in the given address. I expect the issue being on the PHP side, but it could be JS as well.
I assume you have changed the email address to your fathers - is the email address on the same domain. I used to have a website where the security was set so that the emails could not be sent to a different domain.
You are not getting any errors?
I would put this at the top of the contact-form-handler.php page and see what you get:
Yeah you are right, I changed it to an external AOL email address.
I honestly didn’t check for errors. And I don’t know where to do, because after sending the site forwards to another site with something like a “Thank you for submitting” text (that I didn’t style yet).
I guess the errors were in the console of the actual form-site. I have to take the redirection out of the code then right?
Can you make a temporary address on your site with the domain name and test with that to see if it is the problem?
You could put the code I posted on the contact-form-handler.php page as suggested and comment out the redirect line; this should then display the results.
I set up kontakt@taxi-thomas-schulze.de , changed the address of destination in the php file and commented the forwarding code out, added the script you posted within the script tags.
The forwarding did not happen, but after hitting the ‘send’ button, the contact-form-handler.php loads up, but does not show any visible content. Checking the console didn’t show any logs.
The inbox of the address is still empty.
But when I try to reload the contact-form-handler.php, this shows up in the console.
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Are you sure your hosting provider allows the use of the mail() function? Many now require that authenticated SMTP be used instead and block mail() when the to address is not on the same domain as the script.
I didn’t upload the javascript. I uploaded the snippet and linked it in the contact.html head now, but it doesn’t work anyway. I additionally linked the general javascript link into the head.
I would remove JavaScript from the equation. It is only needed for form validation anyway.
Instead make a very basic script to test if the mail() function is even working as expected and go from there:
Thanks for your helpful answers. I honestly didn’t really understand what to do referring to Pullos post.
But I tried the second posts code and - drum roll - it worked.
The ‘thank you’ site appears, the email shows up in the mail account. I checked it with the private address, this didn’t worked. But 1blu.de offers forwarding, so I just forward the email to the private one of my dad.
But the error message loading the website still appears.
Additionally, I would like to have a little different ‘sent’-reaction. Instead of redirecting, I would like to change the text in the ‘send’ button to ‘sent’. Is this even possible? If so, I will try to do this on my own this time :D.