Page 1 of 1

Mail forms

PostPosted: 12. January 2007 16:09
by kkillgasmm
I'm using 'Sams teach yourself php mysql and apache in 24 hours' to learn php and have tried the sample code it has to code a feedback form but i received the following message at the bottom of the resutls page when trying to test it out...

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\xampp\htdocs\xampp\Mystuff\new\listing9.12.php on line 21

i checked my emails and nothing arrived!

any help?
i would have thought it would have worked becuase im sure the book talks about php5!

First attempt at a reply-hope it to be helpful

PostPosted: 23. January 2007 16:07
by bronxtechno
Before doing anything else, please confirm that you can telnet to your smtp server on port 25 with no problems. An example of this from either commandline windows or linux is

telnet mail.yourdomain.com 25

What you should see in response is something that looks like:

220 mail.yourdomain.com ESMTP

If you do not see this, you need to troubleshoot outside of the application first. Look to see if you have a personal firewall that may be blocking you. Check to see if your isp is blocking port 25 access. Find out from your mail server host if there are alternative ports that can be used to test or use.

Hope that helps.

Roy Lopez

aka BronxTechno

PostPosted: 23. January 2007 22:17
by cvdbAdmin
The other thing that you might check is whether or not you have an email server on your system. I may be wrong about this but I don't think Xampp automatically comes with one. If you don't have one then there isn't anything listening to that port and you won't be able to send or receive anything.

PostPosted: 24. January 2007 17:20
by bronxtechno
Good thought, speaking directly to the fact that the error he is seeing is saying failure to connect to mailserver localhost at port 25. That is the default in the php.ini, if smtp was manually enabled (by default sendmail is enable which according to other posts has been reported not to work on windows).

Now comes the confusing part, which php.ini should you fix because by default you may actually have three of them:

c:\program files\xampp\apache\bin\php.ini
c:\program files\xampp\php\php.ini
c:\windows(winnt)\system32\php.ini

It has been said that one by who is more learned than me, that the one that you seek can be found by interrogating the apache httpd.conf file, but that is for you to determine for yourself. I have look but found nothing of help there.

What I have found best to work for me is to edit the one in the apache\bin directory. With that I take my leave of you, wishing a fair wind on your voyage to resolution...