Hi to all again,

Can anyone one help me with this? The scenario goes like this.
I have this PHP script:

<?php

 $to = "email_address_here";
 $subject = "SAMPLE AUTOMATIC MAIL";
 $body = "Hi to Every one. Please help me with this ^^,";	

 if (mail($to, $subject, $body))
 {
      echo("<p>Message successfully sent!</p>");
      echo "Sent to: $to";
 }

?>

Above code works fine. When I type the "http://server/folder/phpfile.php" at my explorer address bar, the message was successfully sent.

I try to use windows schedule task to run this automatically, but it only open the phpfile.php itself. By the way, my I'm using Windows Server 2003 OS.

Note: I don't want to use cron for this activity.

Thanks in advance guys.

Recommended Answers

All 3 Replies

You need to use the php.exe to execute the file. So in your scheduler you'd add something like this:

c:\PHP\php.exe -f "c:\Apache\htdocs\folder\phpfile.php"

Is there anything wrong with my task scheduler? It doesn't work

This issue was solve. I just have some mistake on the path of my file.
Thanks pritaeas. you solve my problem. ^^,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.