Link to home
Start Free TrialLog in
Avatar of Fajer39
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_email=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
Avatar of Chris H
Chris H
Flag of United States of America image

Do you have PHP installed on your web server?
Avatar of Fajer39
Fajer39

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/ajaxcontact2.php
?

Can you wget www.domainname.com/assets/contact/ajaxcontact2.php
?
Avatar of Fajer39

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
Avatar of Fajer39

ASKER

Ok, thank you very much, I'm gonna change the rights and let you know.
Avatar of Fajer39

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.
Avatar of Fajer39

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?
Avatar of Fajer39

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?
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
Avatar of Fajer39

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.
Avatar of Fajer39

ASKER

Well, it's there. See the attachement.

User generated image
Try to wget ajaxcontact only please. I will see that tomorrow, It's late here. Anyway thank you for your help and patience.
SOLUTION
Avatar of Chris H
Chris H
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fajer39

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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fajer39

ASKER

Ok, Thank you guys both. I will look at that PHPMailer.