WordPress.org

Ready to get started?Download WordPress

Forums

MailPoet Newsletters
[resolved] Newsletter on specified hour, not working. (5 posts)

  1. i0n1ca
    Member
    Posted 1 year ago #

    Hello,

    Just found this awesome plugin, and i love it so much. Just figured out how to configure it, and how to make a newsletter.

    I’ve picked the automated newsletter on every day certainlly on 6 am. Here is the problem, when 6am comes i’ve got the message that says 0 out of 6. Pause and a little down says if don’t wanna wait just click and send now.

    I must say that the cron job is not working and my automatic newsletter is not sent.

    1. Setup a SMTP connection, works perfectly, test emails arrived.

    2. wp-cron.php tested and works, tried the version in advance tab to wsygia cron. Set up a cron on host to wget http://iSay.ro/wp-cron.php?830c25b6128d4fce6c092d4fae0151b4&action=wysija_cron&process=all

    on every 10 min. Not working either.

    What should i do?

    A ticket is opened on support site, over 24h and nobody is answering. Nice!

    ionica.

    http://wordpress.org/extend/plugins/wysija-newsletters/

  2. i0n1ca
    Member
    Posted 1 year ago #

    Solved with the help of Ben. Bellow is the solution:

    First my wp-cron.php is not working and still present in root dir of my site.

    1. Save the following code in a file called wp-cron2.php on your desktop.

    <?php
    /**
     * WordPress Cron Implementation for hosts, which do not offer CRON or for which
     * the user has not set up a CRON job pointing to this file.
     *
     * The HTTP request to this file will not slow down the visitor who happens to
     * visit when the cron job is needed to run.
     *
     * @package WordPress
     */
    
    ignore_user_abort(true);
    
    if ( !empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON') )
    	die();
    
    /**
     * Tell WordPress we are doing the CRON task.
     *
     * @var bool
     */
    define('DOING_CRON', true);
    
    if ( !defined('ABSPATH') ) {
    	/** Set up WordPress environment */
    	require_once('./wp-load.php');
    }
    
    if ( false === $crons = _get_cron_array() )
    	die();
    
    $keys = array_keys( $crons );
    $local_time = time();
    
    if ( isset($keys[0]) && $keys[0] > $local_time )
    	die();
    
    foreach ($crons as $timestamp => $cronhooks) {
    	if ( $timestamp > $local_time )
    		break;
    
    	foreach ($cronhooks as $hook => $keys) {
    
    		foreach ($keys as $k => $v) {
    
    			$schedule = $v['schedule'];
    
    			if ($schedule != false) {
    				$new_args = array($timestamp, $schedule, $hook, $v['args']);
    				call_user_func_array('wp_reschedule_event', $new_args);
    			}
    
    			wp_unschedule_event($timestamp, $hook, $v['args']);
    
     			do_action_ref_array($hook, $v['args']);
    		}
    	}
    }
    
    die();

    2. Upload the file using cPanel file manager or using a FTP program to the root of your site, near wp-cron.php

    3. You have to open wp-config.php and add this

    /** Stop Cron jobs automatically
    define('DISABLE_WP_CRON', 'true');
    define('ALTERNATE_WP_CRON', 'true');

    between lines 36-41 to take effect.

    4. Open cPanel>Cron Jobs and set up this 2 jobs
    wget -q --delete-after "http://yourdomain/wp-cron2.php?doing_wp_cron"
    wget -q --delete-after "http://yourdomain/wp-cron2.php"

    Replace yourdomain = your site URL = ex. wordpress.org
    For me is ok to check wp-cron2.php on every 30 minutes. If you want to do this more often do it.

    Why
    -q = run the wget in silent mode, you are not receiving emails about cron job with info. If you want to debug delete it to see the message error.
    --delete-after = after running a wget command a called file would be saved in the root of your domain with 0 bytes, and this commands removes it.

    Cheers,
    ionica.

  3. i0n1ca
    Member
    Posted 1 year ago #

    With the help of WP-Control, you can see witch cron jobs are running on your site, when are programmed to run or edit the cron jobs.

    Thank you guys for making this awesome plugin.

    My problem is solved.

  4. i0n1ca
    Member
    Posted 1 year ago #

    Explanation:
    1. wget -q --delete-after "http://yourdomain/wp-cron2.php"
    This line is used to check cron jobs and make them happen.

    2. wget -q --delete-after "http://yourdomain/wp-cron2.php?doing_wp_cron"
    Automatically when you disable the standard wp-cron.php, the posts schedueled are having the "missed schedueled" and this command make it posibile to post on right time.

    Hope it works,
    ionica

  5. i0n1ca
    Member
    Posted 1 year ago #

    Sorry for my mistake, to work on your site please remove de number "2" from wp-cron2.php

    The codes should look like:

    wget -q --delete-after "http://yourdomain/wp-cron.php"
    wget -q --delete-after "http://yourdomain/wp-cron.php?doing_wp_cron"

    ionica.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic