Constants

Constants define how Newsletter behaves in specific cases which are usually not to be changed. Since WordPress works in very heterogeneous environments and sometimes people have particular needs, those constants can be redefined (at your own risk!).

What's inside

Constants are defined using the PHP define(...) syntax and they can be set in your wp-config.php file before Newsletter is loaded. The Newsletter plugin takes care to check if a constant is already set.

Note: constants cannot be redefined so if you set them in the wrong way Newsletter cannot adjust things later!

A value for a constant can be set using:

define('CONSTANT_NAME', 'value');

Please, do not play with your wp-config.php if you’re unsure on how a PHP file can be edited. Anyway always keep a backup and be prepared to upload the original copy if something goes wrong.

Inside the wp-config.php file, be sure to add the define(s) before the
/* That's all, stop editing! Happy blogging. */
line, otherwise they won’t have any effect!

Main constants

NEWSLETTER_LIST_MAX

This sets the number of lists you can manage for your subscribers. The default value is 40.

Once the value is changed the Newsletter plugin must be deactivated and reactivated, otherwise, the database won’t be updated to make room for the new lists.

Read more about lists on this page.

NEWSLETTER_PROFILE_MAX

This sets the number of extra profile fields you can manage for your subscribers. The default value is 20.

The database could have a max record/row dimension, so if too many fields are added, the operation can fail. A check of the database table structure (wp_newsletter) is required to confirm the fields have been created.

Once the value is changed the Newsletter plugin must be deactivated and reactivated, otherwise, the database won’t be updated to make room for the new lists.

NEWSLETTER_LOG_DIR

This is the folder where the Newsletter plugin saves internal logs. The log level can be set on main settings and, usually, a log file is generated for each different component or module. Logfile names contain a secret token and are rotated monthly.

The folder name MUST NOT end with a slash.

The default value is wp-content/logs/newsletter. The folder is created if not present.

NEWSLETTER_LOG_LEVEL

This constant (ranging from 0 to 4) forces the log level of the Newsletter plugin and is applied to the core functionalities and all the add-ons. The log level can be set on the main settings panel but that value is ignored if the constant is defined.

NEWSLETTER_LICENSE_KEY

Can be used to set the license key instead of setting it on the main settings. On the main settings page, the license key will be detected but not shown.

NEWSLETTER_MEDIA_RESIZE

If set to false blocks the internal image resize which generates pixel-perfect images when adding them to your newsletter. When the feature is disabled, images are added to newsletters as loaded in the media library (which could lead to imperfect message display on some email clients).

When disabled, even the conversion from webp and avif is deactivated and some email clients (Outlook just to cite one) are not able to display those picture formats.

This option is available for those who are storing the media outside the blog, for example, a CDN.

NEWSLETTER_CRON_INTERVAL

Be warned: do not ask for support if you change this value and you then have delivery issues. Changing this value does not make the delivery engine work better or the (sometimes problematic) WordPress scheduler works smoothly.

This sets the interval in seconds of the internal delivery engine. It is set by default to 300 seconds. Some people experimented with a value of 60 seconds and set up an adequate cron trigger to reduce the mail load on the SMTP server. It’s not for everyone!

NEWSLETTER_EXTENSION_UPDATE

It disables the addons (both free and commercial) update: no notification of update available will be shown. To update addons it must be removed, downloaded from the account panel, and reinstalled.

NEWSLETTER_CRON_WARNINGS

If set to true, it disables the admin side warning about the not working scheduler.

NEWSLETTER_SEND_DELAY

This is an integer value that specifies in milliseconds the delay to introduce between every single email that is sent. This is used to slow down the delivery to be compatible with providers requiring a maximum number of emails per second (and compute the rate very strictly).

The delay is expressed in milliseconds, so to have a delay of 1 second the correct value is 1000.

If your max sending rate is specified in emails per second, for example, 5 emails per second, the delay should be 1000/5=200 milliseconds.

The delay is implemented using the usleep() PHP function the plugin has no controls on the precision of this delay.

This delay is not applied when the sending process is managed by a delivery addon in turbo mode.

NEWSLETTER_ANTIBOT

It is a true/false constant that enables or disables the antibot filter during actions like the subscription and the subscriptions. The antibot filter is invisible and it’s activated when a user submits the subscription form or clicks on the unsubscribe link.

NEWSLETTER_ACTION_TYPE

Setting this constant to ajax, all the action links (confirm, unsubscribe, …) use the admin Ajax functionality of WP: which could prevent problems with cache plugins.

The action links change from

https://www.yourdomain.com/?na=action...

to

https://www.yourdomain.com/wp-admin/admin-ajax.php?action=tnp...

Of course, links inside already-sent newsletters won’t change.

NEWSLETTER_TRACKING_TYPE

Setting this constant to ajax, all the action links in newsletters will use the admin Ajax functionality of WP which could prevent problems with cache plugins.

The action links change from:

https://www.yourdomain.com/?nltr=action...

to:

https://www.yourdomain.com/wp-admin/admin-ajax.php?action=tnptr&...