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

mail() in php

Reply to Message Icon

Original Message
Name: ShaqDiesel
Date: March 3, 2008 at 17:42:07 Pacific
Subject: mail() in php
OS: winxp
CPU/Ram: amd64/1Gb
Model/Manufacturer: 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


Report Offensive Message For Removal


Response Number 1
Name: allam_rahmeh
Date: March 4, 2008 at 00:22:49 Pacific
Subject: mail() in php
Reply: (edit)

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


Report Offensive Follow Up For Removal

Response Number 2
Name: StuartS
Date: March 4, 2008 at 04:36:22 Pacific
Subject: mail() in php
Reply: (edit)

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


Report Offensive Follow Up For Removal

Response Number 3
Name: ShaqDiesel
Date: March 4, 2008 at 05:21:25 Pacific
Subject: mail() in php
Reply: (edit)

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.


Report Offensive Follow Up For Removal

Response Number 4
Name: StuartS
Date: March 4, 2008 at 06:33:21 Pacific
Subject: mail() in php
Reply: (edit)

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


Report Offensive Follow Up For Removal

Response Number 5
Name: wheelspinner99
Date: March 4, 2008 at 10:52:15 Pacific
Subject: mail() in php
Reply: (edit)

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.



Report Offensive Follow Up For Removal


Response Number 6
Name: ShaqDiesel
Date: March 8, 2008 at 16:09:50 Pacific
Subject: mail() in php
Reply: (edit)

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


Report Offensive Follow Up For Removal

Response Number 7
Name: StuartS
Date: March 8, 2008 at 16:48:26 Pacific
Subject: mail() in php
Reply: (edit)

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


Report Offensive Follow Up For Removal






Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: mail() in php

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software