-4

http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/

I have downloaded the code from this site. How can i use Cron job to send mail? I am using WIndows XP.Please help me. I am new to PHP.

mplungjan
  • 169,008
  • 28
  • 173
  • 236
sachin
  • 9
  • 3
  • 3
    Have a read of the site to which you link. The first line says `... is a Linux system process`. – Pete Jul 25 '12 at 08:47
  • @Pete if you compare it to Vista, I agree 200%. Anyway, this is not the place for a debate on the different Windows OS. Was just saying that to relax a bit :) – BMN Jul 25 '12 at 08:57

4 Answers4

4

cron is the time-based job scheduler in Unix-like computer operating systems. cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.

See Reference

See this post how to send emails via cron job usng php mysql

Community
  • 1
  • 1
Ahsan Khurshid
  • 9,383
  • 1
  • 33
  • 51
3

Cron is a utility that runs commands on a schedule. It comes as standard with most UNIX and UNIX-like systems, but not with Windows.

You can get cron for windows or use scheduled tasks instead.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
0

Set it up as a Windows Scheduled task, not a cron job.

You can run PHP from the command line like:

C:\PHP5\php.exe -f "C:\PHP Scripts\script.php"

Edit: The link you have supplied is a PHP tool to manage cron jobs. You would need to install a windows version of cron which one of the other answers points out. If you just want to run a task on a regular basis, use the windows scheduler to do it.

Fluffeh
  • 33,228
  • 16
  • 67
  • 80
0

1)To create the batch file

Open Notepad. Paste the line
"C:\xampp\php\php.exe" "C:\xampp\htdocs\test\mail.php"
Click "File" -> "Save As"
Ensure "Save as type:" is set to "All Files"
Save the file as "cron.bat" to your C drive

/Note:test is a Folder name/

2)To schedule the batch file to run

Open Command Prompt
Paste the following SchTasks /Create /SC DAILY /TN “My Task” /TR “C:cron.bat” /ST 09:00
Press Enter This will make the script run 9 AM ever day.

Note:Try this link for more info http://www.howtogeek.com/51236/how-to-create-modify-and-delete-scheduled-tasks-from-the-command-line/

3)mail.php

         <?php      
          $to = "test@yourmailid.com";            
          $subject = "Test mail PHP";            
          $message = "This to Inform You that  Mr.name";         
          $headers  = "MIME-Version: 1.0\n";
          $headers .= "Content-Type: text/html; charset=UTF-8\n";
          $headers .= "From: yourmailid.com <info@example.com>\n";
          mail($to,$subject,$message,$headers);
          echo "Mail Sent.";
          ?>
Renjith P
  • 39
  • 2
  • 8