Jump to main content Jump to doc navigation

virtuNewsletter is a newsletter system for MODX Revolution.

If you want to read the old docs, please see here virtunewsletter.


virtuNewsletter can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, available here: https://modx.com/extras/package/virtunewsletter

Development and Bug Reporting

virtuNewsletter is stored and developed in GitHub, the reposititory can be found here: https://github.com/virtudraft/virtuNewsletter


  1. Set up a newsletter format using common resource on the left tree
  2. In the CMP, add a category, as the newsletter group. Here usergroups can also be applied to a category
  3. Then add a newsletter to the category
  4. select if " is recurring", means that newsletter will be used recursively based on the given time range (weekly, monthly, or yearly), and split into the number of recurring (1 - monthly, 7 - weekly => means daily).

virtuNewsletter uses cron jobs to send the newsletters.

Note: MODX Cloud currently does not provide cron jobs as a service.

Read more about how to set it up in the cron section below.

Email Templates

You will need to provide some email templates for confirmations. These templates are resources, not chunks or standard templates. They can be left unpublished or hidden, it doesn't matter. The pagetitle will be the subject of the email and the content will be the body of the email.

All snippets and chunks inside the resource will be processed. e.g: getResources will be processed to give updates about your site inside the email's body. By using resources, non-techie user won't be horrified with HTML tags if they want to edit the email's content.

This diagram explains which resources are for what:

"Thank you for your subscription" Email

Email template for subscribe confirmation. The default is in core/components/virtunewsletter/elements/emails/activation-email.tpl

Update 1.6.0-beta2: Template can be created inside the CMP and adjusted to culture key.

Update 1.6.0-beta-1: [[+virtuNewsletter.email.subid]] = [[+virtuNewsletter.email.id]]

<p>Hello [[+virtuNewsletter.email.name:default=`[[+virtuNewsletter.email.email]]`]],</p>
<p>Thank you for your subscription.</p>
<p>To complete this, please click this link to activate your account:
    <a href="[[~62?
<p>You can unsubscribe back later if it is required.</p>
<p> </p>
<p><a href="http://www.example.com" target="_blank">Example.com</a></p>

The ID# 62 should be replaced with the resource's ID for the confirmation page, which only contains:


"Your subscription has been activated successfully" Email

Update 1.6.0-beta2: Template can be created inside the CMP and adjusted to culture key.

Email template for confirmed subscription. The default is in core/components/virtunewsletter/elements/emails/activated-email.tpl

<p>Thank you.</p>
<p>Your subscription has been activated successfully.</p>
<p>We will send you the upcoming newsletter once they are published.</p>
<p> </p>
<p><a href="http://www.example.com" target="_blank">Example.com</a></p>

"You have been unsubscribed successfully" Email

Update 1.6.0-beta2: Template can be created inside the CMP and adjusted to culture key.

Email template for unsubscription.

In each newsletter and user can click an unsubscription link. This link will go to the same confirmation page as above, but instead triggering the unsubscribe. The default is in core/components/virtunewsletter/elements/emails/deactivated-email.tpl

<p>Thank you.</p>
<p>Your subscription has been cancelled successfully.</p>
<p>We will no longer send you the upcoming newsletters.</p>
<p> </p>
<p><a href="http://www.example.com" target="_blank">Example.com</a></p>

At this point, the subscriber won't be removed from the system; only be deactivated.

System Settings

Settings Description
virtunewsletter.usergroups Names of usergroups, delimited by comma. These usergroups will be automatically subscribed
virtunewsletter.email_debug Turn this on to dump the email's placeholders to MODX's error log without sending the email
virtunewsletter.email_limit Number of emails per hour for the cron job. Please consult your webhost about email sending limits. 0 (zero) or empty value means unlimited which will send all emails in 1 (one) batch. Default: 50.
virtunewsletter.email_sender From whom the newsletter comes from in the email's header. Default is any value in the system setting's emailsender
virtunewsletter.subscribe_confirmation_tpl Resource's ID as the email template for the new subscription, as the above template: T hank you for your subscription
virtunewsletter.subscribe_succeeded_tpl Resource's ID as the email template for the unsubscription confirmation
virtunewsletter.unsubscribe_succeeded_tpl Resource's ID as the email template for the completed confirmation of the unsubscription
virtunewsletter.readerpage Resource's ID where visitor can access the newsletter via web

Resources, Snippets and Chunks

You need to create 3 more resources with its own snippet in it:

1. Subscribe

Create a resource, and put this snippet as the content.

Example: this is the ID# 61 for the subscribe form below.


2. Confirm

Create a resource, and put this snippet in the content.

Example: this is the ID# 62 in my template examples above.


3. Read

Create a resource, and put this snippet in the content.

Example: this is the ID# 63 for the link in the email's body of the newsletter below. This resource will be the website's newsletter reader page. Use the MODX's original BaseTemplate, without any CSS styles.


To dump the placeholders, use this

[[!virtuNewsletter.reader? &toArray=`1`]]

4. Chunk

The subscribe form (can be a chunk) is simply like this:

<form action="[[~61]]" method="POST">
    <p>Email: <input type="email" name="email"></p>
    <input type="hidden" name="category" value="Customer News">
    <p><input type="submit" name="submit" value="Subscribe"></p>


Simply point the action to the Subscribe page above. The category field is required to set the subscriber to the appropriate Category inside the CMP.


The name itself can be changed, but make sure you have to apply this also to the [[!virtuNewsletter.subscribe? &categoryKey=category]] onthe Subscribe page above

5. The Newsletters

You are now ready to create the newsletters using the common resource.

  1. Create another template that will be acting as the email's body, means without and tags.

  2. Put the CSS styles inside the tag, and it will parsed automatically inline to the email's body.

  3. You might also want to add these placeholders as the unsubscribe link, or link to read this on your website:

Update 1.6.0-beta-1: [[+virtuNewsletter.email.newsid]] = [[+virtuNewsletter.email.id]]

<!-- unsubscribe link -->
<a href="[[~62?
<!-- read the newsletter on the website -->
<a href="[[~63?
]]">read this newsletter on the website</a>

Note: Either &e or &h is pre-requisite. You just need one of them.

Just remember to always put &scheme=full to all link tags, so they will be appended with the full URL of the website.

Custom Manager Page (CMP)



Category is a group of subscribers. The subscriber can be from usergroups, or anonymous subscriber from web page, whom registered using the subscription form. Because this is required for newsletter, then the subscription form must have category field (or anything you define which matches with [[!virtuNewsletter.subscriber? &categoryKey=category]] controller snippet).

So in the CMP you have to create a category first.


This section shows you the registered subscribers, or the auto-registered subscribers which are set on the System Settings ( virtunewsletter.usergroups). Synchronize them if you like.


To use cron in your own hosting, set this command:

php -q /home/xxx[absolute_path]xxx/public_html/assets/components/virtunewsletter/conn/web.php action=web/crons/queues/process site_id=modx12abc345678d90.12345678

Arguments do not have "?" and "&" for Command Line Interface.

If you use third-party cron service, point the address to:


site_id is required! Replace site_id=modx12abc345678d90.12345678 with your site's ID. Look for it inside the core/config/config.inc.php, check the $site_id variable. This also must be updated each time MODX is updated. It is changed!

Heads Up Do not share this site_id to anybody else! This is the MODX's secret to prevent cross-site scripting. If you want to ask something on the forum, remember to replace this value!

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.



$0 per month—let's make that $500!

Learn more