Re: [PHP-WIN] req: help with mail on IIS 6
[email protected] ("noob")
| Newsgroups | php.windows |
|---|---|
| Message-ID | <[email protected]> |
Thanks for everyone's help and suggestions. Mail() was definitely failing when I added some code to echo back the boolean response. I tried sending to a different server where I could monitor what was going on, and Mail() opened a connection through the local SMTP service, but the service was sending a HELO of the Windows server name, not a FQDN, and my other mailserver was rejecting based on that. If I added a rule to allow relaying from the PHP server, mail went through fine. That tells me PHP is able to control the local SMTP service...that is, it's not a security issue on the server itself. Now, I just have to figure out why it's not working if "localhost" is specified in php.ini. Unfortunately, this is a production server, and I can't change php.ini to test except during off hours :( -------------------------------------------------- From: "Niel Archer" <[email protected]> Sent: Tuesday, November 03, 2009 7:36 PM To: <[email protected]> Subject: Re: [PHP-WIN] req: help with mail on IIS 6 >> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer <[email protected]> wrote >> >> > > Hi All: Just joined the list. >> > > >> > > I'm having problems configuring mail in PHP. I have PHP 5.2.9 >> > > installed on >> > > server 2003 std with sp2 installed. The default SMTP service is >> > > running. >> > > I'm running Wordpress without any problems, except for configuring >> > > mail. >> > > >> > > My php.ini file looks like: >> > > >> > > [mail function] >> > > ; For Win32 only. >> > > ;smtp = localhost >> > > ;smtp = 127.0.0.1 >> > > smtp = 192.168.1.6 >> > > smtp_port = 25 >> > > >> > > ; For Win32 only. >> > > sendmail_from = [email protected] >> > > >> > > I've tried each of the three server addresses above, and none of them >> > > work. >> > > >> > > If I try to run a simple test like: >> > > >> > > <?php >> > > $to = "[email protected]"; >> > > $subject = "Test mail"; >> > > $message = "Hello! This is a simple email message."; >> > > $from = "[email protected]"; >> > > $headers = "From: $from"; >> > > mail($to,$subject,$message,$headers); >> > > echo "Mail Sent."; >> > > ?> >> > >> > $headers must be terminated by "\r\n" >> >> Thanks Neil...I went back to the php.net docs for "mail" and picked up >> their >> example, with this syntax: >> >> <?php >> $to = '[email protected]'; >> $subject = 'Test mail'; >> $message = 'hello'; >> $headers = 'From: [email protected]' . "\r\n" . >> 'Reply-To: [email protected]' . "\r\n" . >> 'X-Mailer: PHP/' . phpversion(); >> mail($to, $subject, $message, $headers); >> ?> >> >> (I've replaced the actual "to" and "from" to dummy addresses)...still >> doesn't >> work...I don't get an error when running the script, but no mail is sent. > > Do not use to or from fields in the 'User <[email protected]>' , is > doesn't work on Windows. If I recall correctly, the function silently > fails with these. > >> -- >> PHP Windows Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > -- > Niel Archer > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >