Email auto-CC

This plugin allows a Canopy administrator to configure email addresses that are appended to outgoing emails’ CC/BCC fields, based on the type of message being sent, via the Canopy frontend.

This is primarily visible via the Phase notification functionality.

Note

Another plugin named email_autocc_all operates the same way as documented here but it operates on all emails sent by Canopy, not just the ones explicitly sent via the frontend by users.

The two plugins cannot be used together.

Installation

Ensure that the /opt/checksec/canopy/sample_plugins/email_autocc.py file is copied into Canopy’s plugin directory (/var/opt/checksec/canopy/plugins/) on the Canopy server.

Restart the Canopy server process to allow the plugin to be (re)loaded:

systemctl restart canopy canopy-celery

Check the Canopy logs to ensure that the plugin has been successfully loaded. The log should include entries similar to the follow the following:

INFO [canopy.libs.plugins:84] Loading plugins into package canopy.plugins:
INFO [canopy.libs.plugins:91] > Directory: /var/opt/checksec/canopy/plugins
INFO [canopy.libs.plugins:108]  * email_autocc.py [0.0.1]: Email auto-[B]CC (email-processor)

Configuration

Email addresses are configured via the EMAIL_AUTOCC_ADDRESSES configuration option, accessible in Canopy’s Admin section. The value is required to be a valid JSON object, with the following structure:

{
    "email.phase_starting": {
        "cc": [
            "phasestarting1@example.org",
            "phasestarting2@example.org"
        ],
        "bcc": "somebot@example.org"
    },
    "email.phase_completed": {
        "cc": "phasecompleted@example.org",
        "bcc": "somebot@example.org"
    }
}

The top-level object’s keys identify the message type, as specified in the message template (Templates → Messages). Only exact matches will be recognised.

The inner objects have optional cc and bcc fields. The value of those fields are one or more email addresses, to be appended to the relevant recipient field.

The example configuration above will CC all emails created from the email.phase_starting message templates to phasestarting1@example.org and phasestarting2@example.org, and BCC somebot@example.org. It will also CC all email.phase_completed emails to phasecompleted@example.org, and BCC somebot@example.org.