Page 1 of 1
Help - complete novice trying to send emails from localhost
Posted: Fri Nov 10, 2006 3:21 pm
by dapa
Please can anyone help before I walk away from php?
I am trying to test sending an email from a simple form however I am having no success as I recieve the following error messge;
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:\wamp\www\experiment\CONTACT_FORM_RESPONSE.php on line 40
I have tried to amend the php.ini file but I am not too confident that I have done it correctly.
Please could someone tell me in plain english what I lines I need to change in the php.ini file?
Thanks
dapa
Posted: Fri Nov 10, 2006 3:27 pm
by Burrito
you need to point it to a valid smtp server. obviously you do not have a mail server set up on the web server.
Posted: Fri Nov 10, 2006 3:35 pm
by dapa
Burrito wrote:you need to point it to a valid smtp server. obviously you do not have a mail server set up on the web server.
Ok - so how do I point it to a valid smtp server?
Sorry but as I said I am a complete novice

Posted: Fri Nov 10, 2006 3:39 pm
by RobertGonzalez
Search Google for 'Setting up a local SMTP server'.
Posted: Fri Nov 10, 2006 3:41 pm
by Burrito
change this section in your php.ini
Code: Select all
[mail function]
; For Win32 only.
SMTP = mail.yoursmtpserver.com
smtp_port = 25
you'll need to make sure your smtp server will accept mail from your web server (w/o a log in), or else you're going to need to step up to a different mail solution like swift or something.
Posted: Fri Nov 10, 2006 4:06 pm
by dapa
Burrito wrote:
you'll need to make sure your smtp server will accept mail from your web server (w/o a log in), or else you're going to need to step up to a different mail solution like swift or something.
Thanks but how can I find out if my smtp server will accept mail from your web server?
Posted: Fri Nov 10, 2006 4:10 pm
by Burrito
dapa wrote:Thanks but how can I find out if my smtp server will accept mail from your web server?
you could always try it.
Posted: Fri Nov 10, 2006 4:51 pm
by dapa
Burrito wrote:dapa wrote:Thanks but how can I find out if my smtp server will accept mail from your web server?
you could always try it.
Tried it but it still will not work.
I've just gone at got Swift but I am more confused now
What do I do with Swift?
Posted: Fri Nov 10, 2006 4:56 pm
by Burrito
dapa wrote:What do I do with Swift?
I've never used swift so I can't help you there. We have an entire
forum dedicated to it though so any questions you have about it would be answered there.
Posted: Fri Nov 10, 2006 5:57 pm
by Chris Corbyn
What ISP are you with? Your ISP will usually give you an outgoing mail server. The one you'd place in your email client like outlook or thunderbird. It's usually one of (but not limited to):
outgoing.<yourisp>.tld
smtp.<yourisp>.tld
mail.<yourisp>.tld
For example, gmail uses:
smtp.gmail.com
If you have access to a terminal window which can run the DIG command (a linux box will usally suffice) then you can do this:
Say my email was
phillip@tiddlywinks.info
I could get the SMTP for it (usually) by running:
dig MX tiddlywinks.info
That returns DNS records for the mail exchangers for tiddlywinks.info
That MX server may only receive incoming mail though so don't count on it, but hopefully you get where I'm coming from.