Lewis' Blog Tales from the trenches of information technology

8Sep/120

Mantis email fun – part 2

Download PDF

Well, this is embarrassing... I can't believe I started this draft back in January (of 2012), and let it sit so long. Sorry about that...

You may read up on my involvement with a particular Mantis Bug Tracker installation in part 1 of this series. This time around, I'm going to discuss adding the ability to discourage email recipients from replying to bug update announcements.For some strange reason, Mantis (at least the version with which I've been working) has no admin configuration to adjust default text in its emailed bug reports. Further, unlike Bugzilla, its default reports don't even include the by-now-all-too-familiar:

Do not reply to this email. You can add comments to this bug at...

string at the top of each message. Poking around, I found that the best (easiest? most direct?) way of adding something similar to this (to head off those reply-happy recipients who usually don't realize that when they reply to these things, I'm the poor slob who gets inundated with the messages, and not Mantis) was to tweak custom_strings_inc.php.

Mantis allows for the inclusion of custom text strings when defined in custom_strings_inc.php. This file is not part of the default mantis installation, but rather must be created in the root of the Mantis public html tree. The format of the file is straightforward; here is the complete content of the one I set up for this particular installation:

<?php
# Note that we don't have to remove the Updater entry from the localisation file
if ( lang_get_current() === 'english' ) {

    $s_email_notification_title_for_status_bug_new = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue is now in status NEW (again)';
    $s_email_notification_title_for_status_bug_feedback = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue requires your FEEDBACK.';
    $s_email_notification_title_for_status_bug_acknowledged = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been ACKNOWLEDGED.';
    $s_email_notification_title_for_status_bug_confirmed = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been CONFIRMED.';
    $s_email_notification_title_for_status_bug_assigned = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been ASSIGNED.';
    $s_email_notification_title_for_status_bug_resolved = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been RESOLVED.';
    $s_email_notification_title_for_status_bug_closed = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been CLOSED';

    $s_email_notification_title_for_action_bug_submitted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been SUBMITTED.';
    $s_email_notification_title_for_action_bug_assigned = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been ASSIGNED.';
    $s_email_notification_title_for_action_bug_reopened = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been REOPENED.';
    $s_email_notification_title_for_action_bug_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been DELETED.';
    $s_email_notification_title_for_action_bug_updated = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been UPDATED.';
    $s_email_notification_title_for_action_sponsorship_added = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been SPONSORED.';
    $s_email_notification_title_for_action_sponsorship_updated = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'A sponsorship of the following issue was modified.';
    $s_email_notification_title_for_action_sponsorship_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'A sponsorship of the following issue was withdrawn.';

    $s_email_notification_title_for_action_bugnote_submitted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'A NOTE has been added to this issue.';
    $s_email_notification_title_for_action_duplicate_of_relationship_added = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been set as DUPLICATE OF issue %s.';
    $s_email_notification_title_for_action_has_duplicate_relationship_added = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The issue %s has been set as DUPLICATE OF the following issue.';
    $s_email_notification_title_for_action_related_to_relationship_added = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been set as RELATED TO issue %s.';
    $s_email_notification_title_for_action_dependant_on_relationship_added = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been set PARENT OF issue %s.';
    $s_email_notification_title_for_action_blocks_relationship_added = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been set CHILD OF issue %s.';
    $s_email_notification_title_for_action_duplicate_of_relationship_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been UNset as DUPLICATE OF issue %s.';
    $s_email_notification_title_for_action_has_duplicate_relationship_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The issue %s has been removed as a DUPLICATE OF the following issue.';
    $s_email_notification_title_for_action_related_to_relationship_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been marked as UNRELATED TO issue %s.';
    $s_email_notification_title_for_action_dependant_on_relationship_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been removed as the PARENT OF issue %s.';
    $s_email_notification_title_for_action_blocks_relationship_deleted = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The following issue has been removed as the CHILD OF issue %s.';
    $s_email_notification_title_for_action_relationship_child_resolved = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The RELATED issue %s has been RESOLVED.';
    $s_email_notification_title_for_action_relationship_child_closed = 'Please do NOT reply to this message. To post comments to this issue,' . "\n" . 'please log into your Mantis account.' . "\n\n" . 'The RELATED issue %s has been CLOSED.';

}
?>

As should be evident from the third line, it is possible to include replacement text for multiple languages. In this case, I've only included English, however.

Because custom_strings_inc.php is not packaged with the Mantis tarball, upgrades to the system don't pose a risk of overwriting it with some default content. There are more details concerning custom_strings_inc.php available in the Mantis documentation.

Finally, note that the above strings do not affect admin message, password reminders and resets, etc., but only bug reports.

Last Updated on by

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.