Cron job php to send mass mail

0

I have made a small program in php that consults who is celebrating the day today and sends a congratulatory email to the people who throw the query, with PHPMailer, everything works perfect, now I want to automate it, and I want to create a cron job, but the executable does not work, I do not know what I'm missing, this is my .bat file:

 C:\xampp\php\php.exe -f C:\xampp\htdocs\birthday\Views\Mail\mailer.php

It is assumed that when executing the file, make the query and send the mail, that happens when I load the php page with the browser, the routes are correct, but nothing happens when executing the .bat, I am in windows 10 that it's a team of the company.

I appreciate your help in advance.

    
asked by BastianBurst 08.05.2017 в 16:52
source

1 answer

1

The problem is the directory in which your script runs.

Let's say, if the web runs from C:\xampp\htdocs then your file .bat should have something like this:

cd C:\xampp\htdocs
C:\xampp\php\php.exe -f C:\xampp\htdocs\birthday\Views\Mail\mailer.php

You should also be able to indicate an execution path when creating the cron.

    
answered by 08.05.2017 / 20:42
source