Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / PHP and SMTP Errors on Windows 2008, Help Appreciated

Author
Message
Epimetheus
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Naples, Florida
Posted: 9th Aug 2012 10:43
I have a Windows 2008 r2 server with PHP and SMTP installed and functioning individually, but when PHP attempts to send emails it generates errors in the logs(the script itself executes "successfully" as it returns a success message, but no emails are sent)

SMTP has be verified to work and I have sent out a few emails successfully with it by manually placing files in the mailroot Pickup folder. It sends these email files no problem and generates logs as well.

When running the PHP script it generates no logs in the SMTP virtual server but it does generate this log in php53_errors.log:



I have set php.ini to the appropriate settings(SMTP is running on localhost and port 25) and I also have tried running the script with the proper settings defined in ini_set(). In both cases the same error is generated

Here is my script code:



I installed PHP 5.3.13 via Microsoft's automatic installer.

Any ideas what the problem could be? Thanks!
bitJericho
22
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 9th Aug 2012 11:46
If you were using apache it could also generate an error if there was a configuration/connection issue. Have you checked the IIS logs for an error?

ionstream
20
Years of Service
User Offline
Joined: 4th Jul 2004
Location: Overweb
Posted: 9th Aug 2012 18:11 Edited at: 10th Aug 2012 02:44
EDIT: My post is completely useless. That's what I get for not thoroughly reading the post!

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 10th Aug 2012 00:02
I believe 2008 smtp server is set not to allow relay from any ip address by default, even localhost. Go into smtp server settings, then find the relay settings and add 127.0.0.1 as an allowable inbound ip address.

Boo!
Epimetheus
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Naples, Florida
Posted: 10th Aug 2012 09:13
@Jerico2day

Seems like IIS logs are only showing that the script was accessed with no errors, SMTP logs show nothing, as if SMTP wasn't successfully contacted at all, and PHP logs show that SMTP connection failed

@spooky

Yes that is the default configuration but I changed it before all this to 127.0.0.1, I've also tried referencing 127.0.0.1 instead of "localhost" in my PHP script
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 10th Aug 2012 18:47
Probably just the firewall settings then. Windows 2008r2 is locked down to the extreme and unless you have turned the firewall off (bad idea) you will need to add exceptions such as port 25 to allow smtp traffic through.

Other than that I have no idea.

Boo!
Epimetheus
21
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Naples, Florida
Posted: 11th Aug 2012 09:51
I got it working, for some reason php is relaying mail through the absolute public IP for the server, so I just set SMTP to allow traffic from that IP and it worked, weird since it's technically the same as localhost

idk if this is a secure config though, anyone have any suggestions?

Login to post a reply

Server time is: 2025-05-18 13:20:28
Your offset time is: 2025-05-18 13:20:28