Fajer39
asked on
Simple php form doesn't send email
Hello guys,
I find simple documented php+ js form template + for validation and sending. Code is quite straight-forward - for better viewing experience I posted it on codepen + php. After I click on the button, page will reload with this new address //site.com/?newsletter_ema il=myemail %40google. com and nothing more happens. What's wrong? Thank you in advance
NOTE : click function is inside document.ready function. On the site is another form and it runs onthe same template and works well.
HTML - http://codepen.io/anon/pen/LEvJzm.html
JS - http://codepen.io/anon/pen/LEvJzm.js
PHP - http://codepad.org/VlGCP10f
I find simple documented php+ js form template + for validation and sending. Code is quite straight-forward - for better viewing experience I posted it on codepen + php. After I click on the button, page will reload with this new address //site.com/?newsletter_ema
NOTE : click function is inside document.ready function. On the site is another form and it runs onthe same template and works well.
HTML - http://codepen.io/anon/pen/LEvJzm.html
JS - http://codepen.io/anon/pen/LEvJzm.js
PHP - http://codepad.org/VlGCP10f
Do you have PHP installed on your web server?
ASKER
Yes, I do. Other form is sending mails through PHP from the beginning - with the same emailing template. I must have missed something but I don't know what because I don't know PHP
I'm assuming you're allowing access to and that this virt folder exists:
assets/contact/ajaxcontact 2.php
?
Can you wget www.domainname.com/assets/contact/ajaxcontact2.php
?
assets/contact/ajaxcontact
?
Can you wget www.domainname.com/assets/contact/ajaxcontact2.php
?
ASKER
Yes, It's accesible. I don't know if it helps but it's this site http://goo.gl/NScGwa you can try to submit and see how it behaves. It's the form in the middle of the site.
I'd start by troubleshooting permission on that folder, or maybe move it to where your working script's folder is.
Untitled.png
Untitled.png
ASKER
Ok, thank you very much, I'm gonna change the rights and let you know.
ASKER
Folders have 755 asets/.../ and files 644. I can't simulate wget in windows but when i try it in browser it doesn't give error 500, i see "loaded" a blank page.
An error 500 is local.
ASKER
Epic fail from me, I see. Ok, please what is your suggestions? Why it doesn't work with that permisions?
It should work. 5 is read execute. I'm not sure. Maybe you're local somehow and I'm remote from your firewall's standpoint?
ASKER
Well I tried this php test script and it works, email was sent to me. http://codepad.org/h0JRSnHM
it's in the /assets/contact/samplemail .php So permision looks OK for that script. Can you access that one?
it's in the /assets/contact/samplemail
Put your script there and then change the line I mentioned above to reflect the correct directory, because that one works correctly.
See attached
Untitled.png
See attached
Untitled.png
ASKER
I'm sorry but what do you mean exactly? That testing script is in the same folder as the others. And what line should I change? I see only this message above :
It should work. 5 is read execute. I'm not sure. Maybe you're local somehow and I'm remote from your firewall's standpoint?
ajaxcontact2.php is probably not in that same directory and/or is not labeled correctly.
Remotely, I'm unable to acquire the first script you talk about using wget. The second script downloaded perfectly. Which means, ajaxcontact2.php is not in that physical/virtual directory on the web server. If you just moved it there, try recycling apache or iis.
ASKER
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not working. Again I tried ajaxcontact.php (the first one on which is the second based on) and it's normally working so I have to have something wrong in the code.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, Thank you guys both. I will look at that PHPMailer.