PHP SMTP settings for localhost problem

69 views
Skip to first unread message

matt_thomson

unread,
Oct 2, 2007, 6:02:28 PM10/2/07
to NZ PHP Users Group
Hi, I have recently set up XAMPP on my desktop and I am trying to
configure php so I can send smtp mail with the mail() function.

I get the error message:

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

I have modified the C:\Program Files\xampp\php\php.ini file so it
reads:

[mail function]
; For Win32 only.
SMTP = smtp.woosh.co.nz
smtp_port = 25

; For Win32 only.
sendmail_from = mtho****n...@gmail.com

However in phpinfo(); I am still getting

sendmail_from no value no value
sendmail_path no value no value
SMTP localhost

Can anyone please tell me the correct way to configure PHP/XAMPP so I
can send email with a local host setup.

Thanks.

vinod sobale

unread,
Oct 2, 2007, 6:14:11 PM10/2/07
to nzp...@googlegroups.com
Quite obvious, you cannot send emails form localhost, as far as i am concerned (If you can please let me know), so all you need to do to check whether you function is running or not write one if statement which states

if (function mail runs)

    {

           echo ' mail sent ' ;

  }

localhost error will still be there, but if mail sent statement appears on page, you can confirm that your function is running.

Cheers!!!
--
Vinod Sobale
Web Developer
021 1063 074
Auckland - 1024
New Zealand

Paul Webster

unread,
Oct 2, 2007, 6:15:07 PM10/2/07
to nzp...@googlegroups.com
Check which php.ini XAMPP is using, I got caught out recently when setting
up xampp on my new dev set up.

While you would think you would edit

xampp\php\php.ini

in my case its was actually using (by default)

xampp\apache\bin\php.ini

so this is where you maybe want to change your settings.

IM using XAMPP 1.5.4a

HTH,

Paul.

Thanks.

__________ NOD32 2565 (20071002) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


Jochen Daum

unread,
Oct 2, 2007, 6:22:33 PM10/2/07
to nzp...@googlegroups.com
Hi,

have you restarted your web server?

The setup you have works for me with orcon

Jochen

matt_thomson

unread,
Oct 2, 2007, 8:06:36 PM10/2/07
to NZ PHP Users Group
I tried modifying the php file in xampp\apache\bin\php.ini as Paul
said, and now I am getting the same error, except I have my ISP smtp
in the error, instead of local host. It doesn't suprise me that I cant
smtp out as I am on a big network (at Natcoll design school). I will
try setting it up at home and let you know if it works. Thanks for the
advice.

Jochen Daum

unread,
Oct 2, 2007, 8:10:01 PM10/2/07
to nzp...@googlegroups.com
Hi Matt,

Some ways to circumvent it:

use a class like phpmailer and try direct smtp

use a local mail server like hamster


HTH, Jochen


Reply all
Reply to author
Forward
0 new messages