Executing php file to send mail


I need to send a custom made email using corn job. Manual activation of the file is ok and the mail is sent. Question is, how to set the cronjob in Dolibarr?

I have set Shell command and tried 2 things:

First: set “/opt/cpanel/ea-php73/root/usr/bin/php” as Command and “/home/myname/public_html/dolibarr/path_to_file/daily.stats.php” as comment

Second: Set everything in “Command”

Then I try https://URL/public/cron/cron_run_jobs.php?securitykey=SECURITY_KEY&userlogin=USERNAME&id=cronjobid and the for each option the result is “cron_run_jobs.php cronjobid: 6 priority=0 entity=1 label=TASK_LABEL - qualified - result of run_jobs = 1 - reprogrammed Result: 1 jobs - 1 launched = 1 OK + 0 KO” but e-mail is not send.

I’ve also tried to set a corn job in the Cpanel, using the same command, but again no result (I presume this is because Dolibarr needs user authentication).

Any help appreciated.

P.S.: I am using phpmailer for composing and sending the mail.


Can you check configuration and test mail in your Setup > Emails > Emails Setup

Tweak php.ini in case of any requirements.

If mails go from ERP, then I guess your config in Admin Tools > Scheduled Jobs must work.



yes, test emails are working. Direct access to the .php file via URL also. The problem is with the cronjobs. The return (in most cases) is the login screen for Dolibarr.