[PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread David Armstrong
I'm in the process of helping some developers port their php application
from Linux to Windows (I know, string me up from the flag pole later).  I
have setup WAMP and everything is working fine with the exception of the
mail() function.  The code was originally developed on Linux and leveraged
sendmail for the mail() function.

What can I do to allow the php code to send mail from Windows?  I have
already tried installing the IIS SMTP service and that has not worked so
far.  The Windows box is Server 2008 R2 Standard, so IIS is 7.5 with the IIS
6.0 SMTP component.


Re: [PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread Daniel Brown
On Thu, Jan 6, 2011 at 15:27, David Armstrong darmstrong...@gmail.com wrote:
 I'm in the process of helping some developers port their php application
 from Linux to Windows (I know, string me up from the flag pole later).  I
 have setup WAMP and everything is working fine with the exception of the
 mail() function.  The code was originally developed on Linux and leveraged
 sendmail for the mail() function.

 What can I do to allow the php code to send mail from Windows?  I have
 already tried installing the IIS SMTP service and that has not worked so
 far.  The Windows box is Server 2008 R2 Standard, so IIS is 7.5 with the IIS
 6.0 SMTP component.

Did you update your php.ini on the WIMP/WAMP box to use SMTPm and
to properly configure it for the server?

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread Daniel Brown
On Thu, Jan 6, 2011 at 15:50, David Armstrong darmstrong...@gmail.com wrote:
 I set the following parameters

 [mail function]
 ; For Win32 only.
 ; http://php.net/smtp
 SMTP = localhost
 ; http://php.net/smtp-port
 smtp_port = 25
 sendmail_from = valid account here

Per list rules, please hit reply-all and post your response
below the quoted email in the future.  Thanks.

Did you set these as such before or after you last tested?  And
did you restart Apache/IIS after saving your changes to the php.ini
file?  And lastly, are you certain you edited the correct php.ini
file?  If accessing the script via the web, check out the
Configuration File Path and, specifically, the Loaded Configuration
File entries in your phpinfo() output.

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread David Armstrong
I modified the php.ini in both the apache/bin directory, and also the php
directory.

Is there some way to get a trace of the code execution?  The SMTP log files
are completely worthless.  They do not show any sort of connection attempt.

On Thu, Jan 6, 2011 at 12:58 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jan 6, 2011 at 15:50, David Armstrong darmstrong...@gmail.com
 wrote:
  I set the following parameters
 
  [mail function]
  ; For Win32 only.
  ; http://php.net/smtp
  SMTP = localhost
  ; http://php.net/smtp-port
  smtp_port = 25
  sendmail_from = valid account here

Per list rules, please hit reply-all and post your response
 below the quoted email in the future.  Thanks.

Did you set these as such before or after you last tested?  And
 did you restart Apache/IIS after saving your changes to the php.ini
 file?  And lastly, are you certain you edited the correct php.ini
 file?  If accessing the script via the web, check out the
 Configuration File Path and, specifically, the Loaded Configuration
 File entries in your phpinfo() output.

 --
  /Daniel P. Brown
 Network Infrastructure Manager
 Documentation, Webmaster Teams
 http://www.php.net/



Re: [PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread Daniel Brown
On Thu, Jan 6, 2011 at 16:02, David Armstrong darmstrong...@gmail.com wrote:
 I modified the php.ini in both the apache/bin directory, and also the php
 directory.
 Is there some way to get a trace of the code execution?  The SMTP log files
 are completely worthless.  They do not show any sort of connection attempt.

Per list rules, please hit reply-all and post your response
 below the quoted email in the future.  Thanks.

You can do a debug_print_backtrace()[1] call right after the call
to mail(), or you can use a profiler like Xdebug[2].  You can also
check the Apache error log to see if anything popped up.  It'll be
more helpful if you have error_reporting set to E_ALL, mind you.  If
you just want to see if mail() is encountering any errors itself, wrap
the call in an `if` condition block:

?php

if (!mail($to,$subject,$body,$headers)) {
die('Call to mail() failed in '.__FILE__.'#'.(__LINE__ - 1).'.'.PHP_EOL);
}
?

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread David Armstrong
Thanks Daniel.  I will suggest that to the developer and see if we can get
some useful information to further the troubleshooting process.

On Thu, Jan 6, 2011 at 1:08 PM, Daniel Brown danbr...@php.net wrote:

 On Thu, Jan 6, 2011 at 16:02, David Armstrong darmstrong...@gmail.com
 wrote:
  I modified the php.ini in both the apache/bin directory, and also the php
  directory.
  Is there some way to get a trace of the code execution?  The SMTP log
 files
  are completely worthless.  They do not show any sort of connection
 attempt.

 Per list rules, please hit reply-all and post your response
  below the quoted email in the future.  Thanks.

You can do a debug_print_backtrace()[1] call right after the call
 to mail(), or you can use a profiler like Xdebug[2].  You can also
 check the Apache error log to see if anything popped up.  It'll be
 more helpful if you have error_reporting set to E_ALL, mind you.  If
 you just want to see if mail() is encountering any errors itself, wrap
 the call in an `if` condition block:

 ?php

 if (!mail($to,$subject,$body,$headers)) {
die('Call to mail() failed in '.__FILE__.'#'.(__LINE__ -
 1).'.'.PHP_EOL);
 }
 ?

 --
  /Daniel P. Brown
 Network Infrastructure Manager
 Documentation, Webmaster Teams
 http://www.php.net/



Re: [PHP] mail() function on Windows (WAMP Server)

2011-01-06 Thread Daniel Brown
On Thu, Jan 6, 2011 at 16:10, David Armstrong darmstrong...@gmail.com wrote:
 Thanks Daniel.  I will suggest that to the developer and see if we can get
 some useful information to further the troubleshooting process.

     Per list rules, please hit reply-all and post your response
  below the quoted email in the future.  Thanks.

You bet.  Sorry about the missing references from the other email,
by the way.  I was on the phone and clicked Send a bit too hastily.

^1: http://php.net/debug_print_backtrace
^2: http://xdebug.org/

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php