View Issue Details

IDProjectCategoryView StatusLast Update
0003588mantisbtemailpublic2012-11-28 05:22
Reportermorganparry Assigned To 
Status newResolutionopen 
Summary0003588: Handler may not be emailed when a reported bug is immediately assigned

If users have "email on new" turned off - and in our case, everyone does - then when a bug is assigned in the initial bug report, no email is sent to the handler. This is obviously because of the check around line 248 of email_api.php (in v0.18.1.)

Additional Information

I fixed this locally by adding the following inbetween the two lines of code in the standard email_new_bug() function:

    if( 0 != bug_get_field($p_bug_id, 'handler_id') )
        $t_assign_bcc = email_build_bcc_list( $p_bug_id, 'assigned' );
        if( !empty($t_assign_bcc) )
            if( !empty($t_bcc) )
                $t_bcc .= ", ";
            $t_bcc .= $t_assign_bcc;


related to 0006883 new Email notification during change status with assign 
related to 0007279 acknowledged No email assign notification when bug is immediately assigned 
related to 0006640 closeddhx No email sent when issue assigned through change status 
related to 0006598 new Wrong email notifications are sent if a new issue is immediately assigned ! 




2004-03-03 10:27

reporter   ~0005159

Easier fix for v0.18.2:

  • In email_api.php, modify email_generic() as described in 0003589.

  • In the same file, update email_new_bug() to look like:

    function email_new_bug( $p_bug_id ) {
    email_generic( $p_bug_id, 'new', 'email_notification_title_for_action_bug_submitted', bug_get_field($p_bug_id, 'handler_id') );



2006-08-14 10:40

reporter   ~0013266

Last edited: 2006-08-14 10:40

Under 1.0.5, my email_new_bug() modification just looks like this:

<pre>function email_new_bug( $p_bug_id ) {
email_generic( $p_bug_id, 'new', 'email_notification_title_for_action_bug_submitted' );

if( NO_USER != bug_get_field($p_bug_id, 'handler_id') ) {
    email_assign( $p_bug_id );


This ensures handlers get emailed even if they have <i>email_on_new</i> turned off (but <i>email_on_assigned</i> turned on). It's possible this could end up generating more emails than you ideally want - the extent of this depending on your particular setup - but at least notifications are always sent. I think for typical setups that someone will only receive a redundant email when a bug is reported and immediately assigned to them in a project where they receive notifications for new bugs. That's the case for us anyway.



2007-05-10 07:02

reporter   ~0014489

Last edited: 2007-05-10 07:03

@morganparry: Thanks for this fix. We had the same problem here (no new notifications => no notification at all).

The drawback of getting more than one email is a general problem. In this case the best way would be to suppress the first email if the second one is for the same sender. This is a general mantis issue (but normally this is handled by just calling email_generic once per script).

Idea for better handling (in theory):

Collect all messages during script processing and have a now_send_collected_emails function at the end of the script.

The collect functions should sort the incoming messages by recipient, then by bug_id. For each bug_id the reasons (example "entered as new bug" + "assigned") could be combined (just collect them into one multi-line-string / array):

"This issue is new.
This issue is assigned to <you>.

... issue overview ...

This of course would be a major change but could solve all those double-email-things. Each script run would always result in at most one mail per recipient and bug.



2012-11-28 05:22

reporter   ~0034413

This might be linked to 0014396. This also applies to the other issues already linked to this issue (0003588).

Issue History

Date Modified Username Field Change
2004-02-20 07:33 morganparry New Issue
2004-03-03 10:27 morganparry Note Added: 0005159
2006-07-26 08:57 ryandesign Relationship added related to 0007279
2006-07-26 09:06 ryandesign Relationship added related to 0006640
2006-07-26 09:07 ryandesign Relationship added related to 0006598
2006-07-26 09:08 ryandesign Relationship added related to 0006883
2006-08-14 10:40 morganparry Note Added: 0013266
2006-08-14 10:40 morganparry Note Edited: 0013266
2007-05-10 07:02 stb Note Added: 0014489
2007-05-10 07:03 stb Note Edited: 0014489
2008-07-13 11:32 grangeway Tag Attached: patch
2012-11-28 05:22 JanHegewald Note Added: 0034413