I am developing a simple PHP script that will send emails to users. The script is located outside of WP directory and its run through a cronjob. Example cron job call:
php /PATH/TO/SCIRPT/script.php >> /PATH/TO/SCIRPT/history.log
and here’s part of the code:
<?php require_once "/PATH/TO/WP/wp-load.php"; $res = wp_mail('email', 'title', 'body');
When I use PHP CLI to run the script
$res is always false. But if I run the same script from the web it works just fine.
Below are the server details: ubuntu 16.04lts up-to-date with php 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )
Any help will be much appreciated.