List-Id Header in forum emails

Re: List-Id Header in forum emails

by Howard Miller -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Is it meant to be? It's just an identifier that you can use for mail filtering if you so wish as far as I am aware. 


/**
 * Generate a unique email Message-ID using the moodle domain and install path
 *
 * @param string $localpart An optional unique message id prefix.
 * @return string The formatted ID ready for appending to the email headers.
 */
function generate_email_messageid($localpart = null) {
    global $CFG;
    $urlinfo = parse_url($CFG->wwwroot);
    $base = '@' . $urlinfo['host'];
    // If multiple moodles are on the same domain we want to tell them
    // apart so we add the install path to the local part. This means
    // that the id local part should never contain a / character so
    // we can correctly parse the id to reassemble the wwwroot.
    if (isset($urlinfo['path'])) {
        $base = $urlinfo['path'] . $base;
    }
    if (empty($localpart)) {
        $localpart = uniqid('', true);
    }
    // Because we may have an option /installpath suffix to the local part
    // of the id we need to escape any / chars which are in the $localpart.
    $localpart = str_replace('/', '%2F', $localpart);
    return '<' . $localpart . $base . '>';
}