Re: req: help with mail on IIS 6
| From: | Niel Archer | Date: | Wed, 04 Nov 2009 00:36:59 +0000 |
| Subject: | Re: req: help with mail on IIS 6 | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-29692@lists.php.net to get a copy of this message | ||
> On Tue, 03 Nov 2009 22:19:53 GMT Niel Archer <not@chance.now> 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:
> > >
> > > <?php
> > > $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:
>
> <?php
> $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 <user@address.com>' , 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