Computing.Net > Forums > Web Development > mail() in php

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

mail() in php

Reply to Message Icon

Name: ShaqDiesel
Date: March 3, 2008 at 17:42:07 Pacific
OS: winxp
CPU/Ram: amd64/1Gb
Product: custom
Comment:

Hi, I have a web form I am trying to test. It just gets values from fields and emails them. I get this error:

Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini

Is there something wrong with this configuration in my php.ini? Thank you.

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com



Sponsored Link
Ads by Google

Response Number 1
Name: allam_rahmeh
Date: March 4, 2008 at 00:22:49 Pacific
Reply:

Dear ShaqDiesel;
Try to Config your localserver as SMTP SERVER.
then look-for a real SMTP Provider (don't use HOTMAIL)
Also you have to be connected to internet to do that


Allam Rahmeh
Latakia Syria
it8.biz


0

Response Number 2
Name: StuartS
Date: March 4, 2008 at 04:36:22 Pacific
Reply:

SMTP = localhost equates to SMTP = 127.0.0.1 which means you are sending mail to yourself. Unless you have a mail server running on your computer it doesn't go anywhere.

You should also bear in mind that although most SMTP server use port 25 it is not universal. Some SMTP servers use a different port as an anti-spam measure. You should check with the SMTP provider as to what port they are using.

Stuart


0

Response Number 3
Name: ShaqDiesel
Date: March 4, 2008 at 05:21:25 Pacific
Reply:

sorry, but I'm kind of confused. So is there a way to configure my settings so this will work or do I have to install a mail server(I have apache, would that work?).

This form should read in values from visitors to my site and email them to me.

SMTP=localhost sends it to myself, but I don't have a mail server installed so does that mean I should do SMTP=<my email address>

I'm hoping to get this to work before my website goes live and I appreciate you guys' help.


0

Response Number 4
Name: StuartS
Date: March 4, 2008 at 06:33:21 Pacific
Reply:

You need a mail server of some kind to send Email. You can install a mail server but not Apache, thats a web server or you can use another mail server that you have an account with.

You need something like SMTP=smtp.yahoo.com

You send the Email to Yahoo who then sends it to your Email client like Outlook Express. You cannot send mail directly to Outlook Express, it has to come from a mail server. The sendmail function expects a mail server and nothing else will do.

That's assuming you have an Email account with Yahoo. You will also need a Username and password unless you use an open server and there are not many of them around these days as that is what spammers use.

Mine says smtp=smtpauth.dsl.pipex.com but that would be no use to you unless you have an account with Pipex as I do.

Stuart


0

Response Number 5
Name: wheelspinner99
Date: March 4, 2008 at 10:52:15 Pacific
Reply:

Hey guys,

All he needs is the smtp server address that his ISP provides. I just made a contact page for my website last night using this same method. I'm on comcast so mine is smtp.comcast.net, it's really that simple. No additional software or anything like that.



0

Related Posts

See More



Response Number 6
Name: ShaqDiesel
Date: March 8, 2008 at 16:09:50 Pacific
Reply:

Did you change anything else in php.ini? I corrected my smtp_server value but I get this error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini


0

Response Number 7
Name: StuartS
Date: March 8, 2008 at 16:48:26 Pacific
Reply:

It is still looking for an SMTP server on the local computer and there isn't one.

What SMTP value are you using now?

Be aware that nor all ISPs provide an email service, but if they do, that is the one to use.

SMPT server addresses invariably start with SMTP. It means Simple Mail transfer Protocol. If you have anything else it isn't going to work

The same way that web addresses start with HTTP which means Hyper Text Transfer Protocol.

Stuart


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: mail() in php

How to send mail in php localhost www.computing.net/answers/webdevel/how-to-send-mail-in-php-localhost/3919.html

Date in php www.computing.net/answers/webdevel/date-in-php-/506.html

Open URLs in PHP w/out opening wind www.computing.net/answers/webdevel/open-urls-in-php-wout-opening-wind/199.html