req: help with mail on IIS 6
req: help with mail on IIS 6
am 03.11.2009 19:22:20 von noob
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 = me@mydomain.com
I've tried each of the three server addresses above, and none of them work.
If I try to run a simple test like:
$to = "me@mydomain.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "me@mydomain.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
I don't receive an error, but the mail does not get sent. There's no entry
in the SMTP log, and nothing gets dropped in the "pickup" or "queue" folders
for the SMTP service.
I tried explicitly adding "allow" entries in the SMTP configuration for the
above names/IPs, and also in the "relaying" section, but still nothing. What
can I do to debug?
TIA- da' noob
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: req: help with mail on IIS 6
am 03.11.2009 23:19:53 von Niel Archer
> 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 = me@mydomain.com
>
> I've tried each of the three server addresses above, and none of them work.
> If I try to run a simple test like:
>
>
> $to = "me@mydomain.com";
> $subject = "Test mail";
> $message = "Hello! This is a simple email message.";
> $from = "me@mydomain.com";
> $headers = "From: $from";
> mail($to,$subject,$message,$headers);
> echo "Mail Sent.";
> ?>
$headers must be terminated by "\r\n"
> I don't receive an error, but the mail does not get sent. There's no entry
> in the SMTP log, and nothing gets dropped in the "pickup" or "queue" folders
> for the SMTP service.
>
> I tried explicitly adding "allow" entries in the SMTP configuration for the
> above names/IPs, and also in the "relaying" section, but still nothing. What
> can I do to debug?
>
> TIA- da' noob
>
>
> --
> 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
Re: req: help with mail on IIS 6
am 03.11.2009 23:36:55 von dot net noob
On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer 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 = me@mydomain.com
> >
> > I've tried each of the three server addresses above, and none of them work.
> >
> > If I try to run a simple test like:
> >
> >
> > $to = "me@mydomain.com";
> > $subject = "Test mail";
> > $message = "Hello! This is a simple email message.";
> > $from = "me@mydomain.com";
> > $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:
$to = 'you@you.com';
$subject = 'Test mail';
$message = 'hello';
$headers = 'From: me@me.com' . "\r\n" .
'Reply-To: wme@me.com' . "\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.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: req: help with mail on IIS 6
am 04.11.2009 00:53:39 von Richard Quadling
2009/11/3 dot net noob :
> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer wrote
>
>> > Hi All: Just joined the list.
>> >
>> > I'm having problems configuring mail in PHP. I have PHP 5.2.9 installe=
d on
>> > server 2003 std with sp2 installed. The default SMTP service is runnin=
g.
>> > I'm running Wordpress without any problems, except for configuring mai=
l.
>> >
>> > My php.ini file looks like:
>> >
>> > [mail function]
>> > ; For Win32 only.
>> > ;smtp =3D localhost
>> > ;smtp =3D 127.0.0.1
>> > smtp =3D 192.168.1.6
>> > smtp_port =3D 25
>> >
>> > ; For Win32 only.
>> > sendmail_from =3D me@mydomain.com
>> >
>> > I've tried each of the three server addresses above, and none of them =
work.
>> >
>> > If I try to run a simple test like:
>> >
>> > Â Â
>> > Â Â $to =3D "me@mydomain.com";
>> > Â Â $subject =3D "Test mail";
>> > Â Â $message =3D "Hello! This is a simple email message.";
>> > Â Â $from =3D "me@mydomain.com";
>> > Â Â $headers =3D "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 th=
eir
> example, with this syntax:
>
>
> $to    =3D 'you@you.com';
> $subject =3D 'Test mail';
> $message =3D 'hello';
> $headers =3D 'From: me@me.com' . "\r\n" .
> Â Â 'Reply-To: wme@me.com' . "\r\n" .
> Â Â 'X-Mailer: PHP/' . phpversion();
> mail($to, $subject, $message, $headers);
> ?>
>
> (I've replaced the actual "to" and "from" to dummy addresses)...still doe=
sn't
> work...I don't get an error when running the script, but no mail is sent.
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Can you telnet to port 25 on the server hosting the SMTP service?
Use something like Wireshark to watch what actually happens?
Does the mail() call return true or false?
Can you upgrade to PHP 5.30 and try setting the mail.log [1]?
Regards,
Richard.
[1] http://docs.php.net/manual/en/mail.configuration.php#ini.mai l.log
--=20
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: req: help with mail on IIS 6
am 04.11.2009 01:07:39 von Jan Svoboda
Hi,
Have you tried smtp =3D 127.0.0.1 in php.ini ? I looks like PHP can't =20=
even connect to the smtp service.
Jan Svoboda
Odesláno z iPhone
4.11.2009 v 0:53, Richard Quadling :
> 2009/11/3 dot net noob :
>> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer wrote
>>
>>>> Hi All: Just joined the list.
>>>>
>>>> I'm having problems configuring mail in PHP. I have PHP 5.2.9 =20
>>>> installed on
>>>> server 2003 std with sp2 installed. The default SMTP service is =20
>>>> running.
>>>> I'm running Wordpress without any problems, except for =20
>>>> configuring mail.
>>>>
>>>> My php.ini file looks like:
>>>>
>>>> [mail function]
>>>> ; For Win32 only.
>>>> ;smtp =3D localhost
>>>> ;smtp =3D 127.0.0.1
>>>> smtp =3D 192.168.1.6
>>>> smtp_port =3D 25
>>>>
>>>> ; For Win32 only.
>>>> sendmail_from =3D me@mydomain.com
>>>>
>>>> I've tried each of the three server addresses above, and none of =20=
>>>> them work.
>>>>
>>>> If I try to run a simple test like:
>>>>
>>>>
>>>> $to =3D "me@mydomain.com";
>>>> $subject =3D "Test mail";
>>>> $message =3D "Hello! This is a simple email message.";
>>>> $from =3D "me@mydomain.com";
>>>> $headers =3D "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 =20=
>> up their
>> example, with this syntax:
>>
>>
>> $to =3D 'you@you.com';
>> $subject =3D 'Test mail';
>> $message =3D 'hello';
>> $headers =3D 'From: me@me.com' . "\r\n" .
>> 'Reply-To: wme@me.com' . "\r\n" .
>> 'X-Mailer: PHP/' . phpversion();
>> mail($to, $subject, $message, $headers);
>> ?>
>>
>> (I've replaced the actual "to" and "from" to dummy =20
>> addresses)...still doesn't
>> work...I don't get an error when running the script, but no mail is =20=
>> sent.
>>
>>
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Can you telnet to port 25 on the server hosting the SMTP service?
>
> Use something like Wireshark to watch what actually happens?
>
> Does the mail() call return true or false?
>
> Can you upgrade to PHP 5.30 and try setting the mail.log [1]?
>
> Regards,
>
> Richard.
>
> [1] http://docs.php.net/manual/en/mail.configuration.php#ini.mai l.log
>
>
> --=20
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer : =
http://zend.com/zce.php?c=3DZEND002498&r=3D213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: req: help with mail on IIS 6
am 04.11.2009 01:21:35 von Niel Archer
> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer 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 = me@mydomain.com
> > >
> > > I've tried each of the three server addresses above, and none of them work.
> > >
> > > If I try to run a simple test like:
> > >
> > >
> > > $to = "me@mydomain.com";
> > > $subject = "Test mail";
> > > $message = "Hello! This is a simple email message.";
> > > $from = "me@mydomain.com";
> > > $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:
>
>
> $to = 'you@you.com';
> $subject = 'Test mail';
> $message = 'hello';
> $headers = 'From: me@me.com' . "\r\n" .
> 'Reply-To: wme@me.com' . "\r\n" .
> 'X-Mailer: PHP/' . phpversion();
> mail($to, $subject, $message, $headers);
> ?>
You still aren't terminating each line of $headers with the "\r\n" pair.
This is required by the RFC, and failing to do so can produce unexpected
results, depending on the software processing it.
> (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.
I hope these two addresses are different. I had problems getting mail() to
work when they are the same. Never found out why ;-)
You should test the return value to see if the agent is accepting the
mail. Something like:
if (! mail($to, $subject, $message, $headers)) {
echo "Failure to accept mail!";
}
is enough to know if it's accepted or not.
--
Niel Archer
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: req: help with mail on IIS 6
am 04.11.2009 01:33:16 von Niel Archer
Hi
if you just want to have mail working, and are not insistent upon using
mail(), I would suggest looking at the PEAR::Mail package. It is worth
the effort.
--
Niel Archer
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: req: help with mail on IIS 6
am 04.11.2009 01:36:59 von Niel Archer
> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer 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 = me@mydomain.com
> > >
> > > I've tried each of the three server addresses above, and none of them work.
> > >
> > > If I try to run a simple test like:
> > >
> > >
> > > $to = "me@mydomain.com";
> > > $subject = "Test mail";
> > > $message = "Hello! This is a simple email message.";
> > > $from = "me@mydomain.com";
> > > $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:
>
>
> $to = 'you@you.com';
> $subject = 'Test mail';
> $message = 'hello';
> $headers = 'From: me@me.com' . "\r\n" .
> 'Reply-To: wme@me.com' . "\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 ' , 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
Re: req: help with mail on IIS 6
am 04.11.2009 16:18:42 von dot net noob
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"
Sent: Tuesday, November 03, 2009 7:36 PM
To:
Subject: Re: [PHP-WIN] req: help with mail on IIS 6
>> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer 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 = me@mydomain.com
>> > >
>> > > I've tried each of the three server addresses above, and none of them
>> > > work.
>> > >
>> > > If I try to run a simple test like:
>> > >
>> > >
>> > > $to = "me@mydomain.com";
>> > > $subject = "Test mail";
>> > > $message = "Hello! This is a simple email message.";
>> > > $from = "me@mydomain.com";
>> > > $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:
>>
>>
>> $to = 'you@you.com';
>> $subject = 'Test mail';
>> $message = 'hello';
>> $headers = 'From: me@me.com' . "\r\n" .
>> 'Reply-To: wme@me.com' . "\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 ' , 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
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php