Setting up posting with cron

I made the settings related to processing the queue with cron in my config file, but after cron runs, even though I stop it from crontab, the mails still continue to be sent when I stop the campaign, it just stops.

my phplist version : 3.6.8
my php version : 7.4.30 nginx fpm

My config.php



* ==============================================================================================================
* The minimum requirements to get phpList working are in this file.
* If you are interested in tweaking more options, check out the config_extended.php file
* or visit
* ** NOTE: To use options from config_extended.php, you need to copy them to this file **


// what is your Mysql database server hostname
$database_host = 'localhost';

// what is the name of the database we are using
$database_name = 'mydatabase';

// who do we log in as?
$database_user = 'myuser';

// and what password do we use
$database_password = 'mypassword';

// if TEST is set to 1 (not 0) it will not actually send ANY messages, but display what it would have sent
// this is here, to make sure you edited the config file and mails are not sent "accidentally"
// on unmanaged systems

define('TEST', 0);

* Settings for handling bounces
* This section is OPTIONAL, and not necessary to send out mailings, but it is highly recommended to correctly
* set up bounce processing. Without processing of bounces your system will end up sending large amounts of
* unnecessary messages, which overloads your own server, the receiving servers and internet traffic as a whole


// Message envelope.

// This is the address that most bounces will be delivered to
// Your should make this an address that no PERSON reads
// but a mailbox that phpList can empty every so often, to process the bounces

// $message_envelope = 'listbounces@yourdomain';

// Handling bounces. Check README.bounces for more info
// This can be 'pop' or 'mbox'
$bounce_protocol = 'mbox';

// set this to 0, if you set up a cron to download bounces regularly by using the
// commandline option. If this is 0, users cannot run the page from the web
// frontend. Read README.commandline to find out how to set it up on the
// commandline

// when the protocol is pop, specify these three
$bounce_mailbox_host = '';
$bounce_mailbox_user = '';
$bounce_mailbox_password = 'mypassword';

// the "port" is the remote port of the connection to retrieve the emails
// the default should be fine but if it doesn't work, you can try the second
// one. To do that, add a # before the first line and take off the one before the
// second line
$bounce_mailbox_port = '993';
//$bounce_mailbox_port = "110/pop3";

// it's getting more common to have secure connections, in which case you probably want to use
//$bounce_mailbox_port = "995/pop3/ssl/novalidate-cert";

// when the protocol is mbox specify this one
// it needs to be a local file in mbox format, accessible to your webserver user
$bounce_mailbox = '/var/spool/mail/listbounces';

// set this to 0 if you want to keep your messages in the mailbox. this is potentially
// a problem, because bounces will be counted multiple times, so only do this if you are
// testing things.
$bounce_mailbox_purge = 1;

// set this to 0 if you want to keep unprocessed messages in the mailbox. Unprocessed
// messages are messages that could not be matched with a user in the system
// messages are still downloaded into phpList, so it is safe to delete them from
// the mailbox and view them in phpList
$bounce_mailbox_purge_unprocessed = 1;

// how many bounces in a row need to have occurred for a user to be marked unconfirmed
$bounce_unsubscribe_threshold = 5;

// choose the hash method for password
// check the extended config for more info
// in most cases, it is fine to leave this as it is
define('HASH_ALGO', 'sha256');

// ------------------------------------------------------------------

// if you change the path to the phpList system, make the change here as well
// path should be relative to the root directory of your webserver (document root)
// If you install phpList in the document root then the value should be an empty string, not '/'.
// Warning: Do not change this after installation. You can only change this before you
// install and initialise phpList.
$pageroot = '';

// use Register to "register" to Once you set TEST to 0, the system will then
// request the "Powered By" image from, instead of locally. This will give me
// a little bit of an indication of how much it is used, which will encourage me to continue
// developing phpList. If you do not like this, set Register to 0.
define('REGISTER', 0);

// If you set up your system to send the message automatically (from commandline),
// you can set this value to 0, so "Process Queue" will disappear from the site
// this will also stop users from loading the page on the web frontend, so you will
// have to make sure that you run the queue from the commandline
// check README.commandline how to do this
define('MANUALLY_PROCESS_QUEUE', 0); // Default 1

// to avoid overloading the server that sends your email, you can add a little delay
// between messages that will spread the load of sending
// you will need to find a good value for your own server
// value is in seconds, and you can use fractions, eg "0.5" is half a second
// (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE', 240); // Default 0

// set this to 1 to allow adding attachments to the mails
// caution, message may become very large. it is generally more
// acceptable to send a URL for download to users
// using attachments requires PHP 4.1.0 and up

// the attachment repository is the place where the files are stored (if you use
// this needs to be writable to your webserver user
// it also needs to be a full path, not a relative one
// for secutiry reasons it is best if this directory is not public (ie below
// your website document root)
$attachment_repository = '/tmp';



Message sending options
* phpList now only uses phpMailer for sending, but below you can
* tweak a few options on how that is done



// If you are using PHPMailer 5 then you can use a different version to the phplist distribution by specifying
// the location of the PHPMailer autoload file
// if not set, the PHPMailer version included in the distribution will be used
// eg for Debian based systems, it may be something like the example below
// when you do this, you may need to run some tests, to see if the phpMailer version you have works ok
//define ('PHPMAILER_PATH', '/usr/share/php/libphp-phpmailer/PHPMailerAutoload.php');
// If you are using PHPMailer 6 then you can use a different version by setting the location of the PHPMailer
// src directory, e.g.
//define ('PHPMAILER_PATH', '/var/www/PHPMailer-master/src');

// To use a SMTP server please give your server hostname here, leave it blank to use the standard
// PHP mail() command.
define('PHPMAILERHOST', '');

// in the above you can specify multiple SMTP servers like this:
// 'server1:port1;server2:port2;server3:port3' eg

// if you want to use smtp authentication when sending the email uncomment the following
// two lines and set the username and password to be the correct ones
$phpmailer_smtpuser = '';
$phpmailer_smtppassword = 'mypassword';

//# you can set this to send out via a different SMTP port

//# test vs blast
// you can send test messages via a different SMTP host than the actual campaign queue
// if not set, these default to the above PHPMAILERHOST and PHPMAILERPORT
// define('PHPMAILERTESTHOST','');

// to use SSL/TLS when sending set this value
// it can either be "ssl" or "tls" or false to not use SSL/TLS at all

//# SMTP debugging
// Enable debugging output by phpmailer when sending test emails
// See
// define('PHPMAILER_SMTP_DEBUG', 0);

//# Smtp Timeout
//# If you use SMTP for sending, you can set the timeout of the SMTP connection
//# defaults to 5 seconds
// define('SMTP_TIMEOUT',5);

// Pop-Before-Smtp
// If you use Pop before Smtp, set to true
// And complete smtp settings (PHPMAILERHOST,  phpmailer_smtpuser', phpmailer_smtppassword)
define('POP_BEFORE_SMTP', false);
define('POPBEFORESMTP_DEBUG', false);

Please help me @duncanc

@ibrahimdolas You haven’t really explained what the problem is.

phplist will continue sending out emails unless you suspend the campaign, which is what I think you did.

Changing the crontab won’t have any effect on phplist that is already running.

@duncanc Thanks for answering my question.

I have a campaign and since I don’t want this campaign to be sent automatically by phplist, I edited my config.php file and defined cron on my server. I set it to run 6 days a week and 16 hours a day, although the cron job does not run on the days and hours I disabled, the campaign submission does not stop.
My cron : * 7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 * * 1,2,3,4,5,6 /opt/plesk/php/7.4/bin/php /myphplistdirectory/admin/index.php -p processqueue -c /myphplistdirectory/config/config.php > /root/phplist.log 2>&1

@ibrahimdolas You might want to use batch processing to limit the number of emails that phplist will send in one run.See Setting the Send Speed... | phpList manual

1 Like

@duncanc Does the phplist campaign start and resume button only affect the status column in the phplist_message table in the database?
Do you have an answer for this?

@ibrahimdolas Do you mean “suspend and resume”?
Yes they change the status of the campaign on the phplist_message table. You can look at the code in the file admin/messages.php

1 Like