• Hello,
    I am developing a simple php sccript that will sent emails to users.
    The script is located outside of WP directory and its run through cronjob.
    Example cron job call:
    php /PATH/TO/SCIRPT/script.php >> /PATH/TO/SCIRPT/history.log

    and here’s part of the code:

    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 web it woks just fine.

    Any help will be much appritiated.

    • This topic was modified 6 years, 7 months ago by bcworkz. Reason: changed tag to recommended WP-CLI
    • This topic was modified 5 years, 1 month ago by Marius L. J..
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Use wp_mail() from oputside of WP and through CLI’ is closed to new replies.