Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with PHP mail function using localhost

Status
Not open for further replies.

BobRodes

Instructor
May 28, 2003
4,215
US
I'm attempting to set up test email from my development machine. I have code that uses the mail function and works elsewhere. I don't want to use my ISP's SMTP provider unless I have to.

I'm getting this error:

Code:
PHP Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25 (etc etc)

I have the following settings in php.ini (it's the only php.ini I have on my machine, so I assume it's the one being used when PHP is loaded):

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

And I have gone into IIS7's manager and set up the following in the "SMTP Email" area:

1. Use localhost
2. Port 25
3. Authentication settings (tried both "not required" and "windows"

I don't understand why this doesn't work. Can someone enlighten me?

TIA,

Bob
 
Maybe a little obvious, but since you are not using your ISP's SMTP server, do you have an SMTP server installed on your development machine?






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Yes, great question! I'm afraid I'm not sure. Do I have to do anything besides set the parameters in IIS7? If not, is there a Microsoft download I have to do?
 
Okay, I'm googling around and it appears that Vista doesn't have a native SMTP server. I'll keep researching and post back what I find.
 
This is not a PHP question anymore, but an SMTP one. I'll repost to a more appropriate forum.
 
I don't believe Microsoft has any SMTP server to add on to IIS, however you can try Free SMTP Server from here:



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
there is an smtp server that MS provides with windows installs. you normally need to install it from the add new software dialog in control panel. once installed it integrates with the IIS snap-ins.

alternatively use phpmailer and its SMTP class.
 
jpadie, really? I did not know that. I'll have to look into that one.
I suspect its only available in the Server Versions of Windows?


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
xp pro, winserver 2003 definitely. i've got win vista and win 7 beta as VM's but have not fired them up to test.
 
Most of the google stuff I've seen says that Microsoft doesn't make an SMTP server available for Vista. Also, jpadie, it isn't a selection on the "turn windows features on or off" dialog in Vista. Furthermore, I'm unable to find an "add new software" dialog in the control panel in Vista.

I downloaded and installed the freesmtp server. It's very simple as advertised, and only lets you send 10 emails every 24 hours, whether successful or not. After that, it hits you up for a not-free version. Not a very good resource if you're trying to troubleshoot an email solution!

I don't think we've found a solution, but thanks for trying to help. I'm going to use my ISP provider's SMTP server.
 
as said, i have not tested on vista - i have never seen the value in upgrading from XP. i'll take your word on it that the server is absent on vista but assume it is still present on the server flavours as vacunita suggests. i should have been more qualified in my original post.

however you should not need a local smtp server. and if you have one, and are using any kind of adsl connection, you may find yourself roundly blocked by lots of spam tools.

it is much better, if you are able, to use your ISP's smtp service to send mails. you can address this service very easily using phpmailer and its smtp class, as i posted above.

I know that you said you did not want to do so. is there any reason that might help us find a workaround?

another alternative is to download virtualbox and an image of a *nix distro and fire that up. configure the NIC in bridge mode (so the *nix vBox sits on the local lan and is addressable by your php installation without the need for routing rules) and point the phpmailer class at the vBox server, or even point the php.ini settings at the vBox server. remember, of course, to turn on and configure relaying of the *nix smtp server.

note that you can get _very_ light *nix distro's that will not murder system resources or hard disk footprint. See here for examples
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top