Hi everyone,
Well, more weirdness. I tested the code this afternoon and it actually
worked on the Windows box -- twice -- sent the email upon initial page
load and again when I reloaded the page. But then completely stopped
working. This was before I had created the php.ini file, and the only
two times it ever worked on the Windows box.
I then tested the same code on my domain server (a Linux/Apache setup)
and it worked like clockwork, so it is most definitely NOT my code that
is the issue (or stuff needs to be added to the code to work with
Windows).
Pretty basic mail() code:
//===
$to = '[EMAIL PROTECTED]';
$subject = 'Completing your Registration';
$message = 'Hello there!Hello there!Hello there!Hello there!Hello there!
Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!
Hello there!Hello there!Hello there!Hello there!Hello there!Hello there!
Hello there!Hello there!';
$headers = 'From: [EMAIL PROTECTED]' . "\r\n";
$wmessage = wordwrap($message,70);
mail($to, "Subject: $subject", $wmessage, $headers);
//===
I then created a php.ini file and put the following in it:
SMTP = localhost
smtp_port = 25
sendmail_from = [EMAIL PROTECTED]
and put this first in my local directory and then in the root
directory; tested each time and still no dice, mail is not sending...
--Kristina
> Hello Kristina,
>
> Friday, April 25, 2008, 3:16:55 AM, you wrote:
>
> > Hi Paul,
>
> > Thanks. We are on PHP 4.x and Windows 2003 server and looking
through
> > the directories through FTP, there doesn't appear to be an existing
> > PHP.INI file...the tech support is directing my client in what
settings
> > to configure in PHP.INI (Port 25 and STMP=localhost and so
on)...I'm
> > assuming for PHP 4.x I have to create this PHP.INI file?
>
> > Is it worth trying the below on a 4.x platform?
>
> > --Kristina
>
> >> Hi Kristina
> >>
> >> I was wrestling with this problem a few months ago, I remember
having
> > to do
> >> some fiddling with the PHP.INI. Anyway the coding below works for
> > WINDOWS
> >> and PHP 5
> >>
> >>
> >> <?php session_start; ob_start;
> >> ini_set("SMTP", "smtp.isp.com");
> >> ini_set("smtp_port", "25");
> >> ini_set("sendmail_from", [EMAIL PROTECTED]);
> >>
> >> $to = "[EMAIL PROTECTED]";
> >> $subject = "Enter your subject here";
> >>
> >> $message = "YES IT WORKED @ LONG LAST
> >> I can put anything I like here";
> >>
> >>
> >> $from = "FROM: [EMAIL PROTECTED] ";
> >> mail("$to", "$subject", "$message", "$from");
> >>
> >> echo "The email has been sent";
> >> ?>
> >>
> >> Paul
> >>
> >> ----- Original Message -----
> >> From: "Kristina Anderson" <[EMAIL PROTECTED]>
> >> To: <[email protected]>
> >> Sent: Thursday, April 24, 2008 12:28 AM
> >> Subject: [nyphp-talk] using PHP mail function on Windows server?
> >>
> >>
> >> > Hi everyone --
> >> >
> >> > My current client's app is a PHP 4 site running on a Windows box
> > (don't
> >> > ask...I have no idea why). I'm trying to use the mail()
function
> > and
> >> > the mail isn't cooperating.
> >> >
> >> > (Two things that I noticed in phpinfo() are that Internal
Sendmail
> >> > Support for Windows is enabled and the Zend engine is installed.
> >> >
> >> > So maybe I could/should be using another method to send the
mails,
> > or
> >> > there is a trick that I'm not aware of that I need to use to get
> > this
> >> > to work?)
> >> >
> >> > It's not necessarily super high volume but we will be sending a
> >> > significant amount of automated emails to registered people on
the
> > site.
> >> >
> >> > Thanks for any help...
> >> >
> >> > --Kristina (completely Uncertified in PHP and Unsure why the
mail
> > is
> >> > not sending!)
> >> >
> >> > _______________________________________________
> >> > New York PHP Community Talk Mailing List
> >> > http://lists.nyphp.org/mailman/listinfo/talk
> >> >
> >> > NYPHPCon 2006 Presentations Online
> >> > http://www.nyphpcon.com
> >> >
> >> > Show Your Participation in New York PHP
> >> > http://www.nyphp.org/show_participation.php
> >>
> >> _______________________________________________
> >> New York PHP Community Talk Mailing List
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >>
> >> NYPHPCon 2006 Presentations Online
> >> http://www.nyphpcon.com
> >>
> >> Show Your Participation in New York PHP
> >> http://www.nyphp.org/show_participation.php
> >>
> >>
>
> > _______________________________________________
> > New York PHP Community Talk Mailing List
> > http://lists.nyphp.org/mailman/listinfo/talk
>
> > NYPHPCon 2006 Presentations Online
> > http://www.nyphpcon.com
>
> > Show Your Participation in New York PHP
> > http://www.nyphp.org/show_participation.php
>
> > __________ NOD32 3053 (20080424) Information __________
>
> > This message was checked by NOD32 antivirus system.
> > http://www.eset.com
>
>
> php.ini is probably in the WINDOWS folders or the equivalent on your
> server as is my.ini as I remember.
>
> --
> Best regards,
> mikesz mailto:[EMAIL PROTECTED]
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php