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
LVL 1
Fajer39Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris HInfrastructure ManagerCommented:
Do you have PHP installed on your web server?
0
Fajer39Author Commented:
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
0
Chris HInfrastructure ManagerCommented:
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
?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Fajer39Author Commented:
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.
0
Chris HInfrastructure ManagerCommented:
I'd start by troubleshooting permission on that folder, or maybe move it to where your working script's folder is.
Untitled.png
0
Fajer39Author Commented:
Ok, thank you very much, I'm gonna change the rights and let you know.
0
Fajer39Author Commented:
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.
0
Chris HInfrastructure ManagerCommented:
An error 500 is local.
0
Fajer39Author Commented:
Epic fail from me, I see. Ok, please what is your suggestions? Why it doesn't work with that permisions?
0
Chris HInfrastructure ManagerCommented:
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?
0
Fajer39Author Commented:
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?
0
Chris HInfrastructure ManagerCommented:
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
0
Fajer39Author Commented:
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?
0
Chris HInfrastructure ManagerCommented:
ajaxcontact2.php is probably not in that same directory and/or is not labeled correctly.
0
Chris HInfrastructure ManagerCommented:
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.
0
Fajer39Author Commented:
Well, it's there. See the attachement.

proof.gif
Try to wget ajaxcontact only please. I will see that tomorrow, It's late here. Anyway thank you for your help and patience.
0
Chris HInfrastructure ManagerCommented:
Recycle your webswrver
0
Fajer39Author Commented:
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.
0
SSupremeCommented:
This is very tricky question because all servers are different and therefore hard to assist without having access to server itself to setup PHP mail, firewall, ports. If you have hosting from host provider you should ask them whether sendmail is enabled on first place, mail() function is also part of sendmail. Some providers block sendmail by default and you cannot use it.
Another option, hassle free, is SMTP. All you need is mock email from any free email box provider (gmail for example) and script from https://github.com/PHPMailer/PHPMailer . It is widely used across internet and very well documented.

My suggestion is you should use SMTP. It would not take much time to set up and run.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fajer39Author Commented:
Ok, Thank you guys both. I will look at that PHPMailer.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.