View Issue Details

IDProjectCategoryView StatusLast Update
0024224mantisbtemailpublic2018-04-04 23:35
Reportercbspencer Assigned Toatrol  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionduplicate 
Platformx86_64OSLinux/GNUOS Version2.6
Product Version2.11.1 
Fixed in Version2.13.0 
Summary0024224: Stale emails can remain queued for years
Description

This problem was originally found in v1.2.18, but it appears that it could still occur in v2.11.1 (although we have not seen it in our v2.11.1 installation).

While investigating some email issues in Mantis, we noted that there were a few emails that had been enqueued in 2013 but still had not been sent in 2018, despite Mantis trying to sent them every time any tickets were emailed. The problem was that one of the email addresses to which these "stale" emails were to be sent was incorrectly formatted (unknown why). Every time Mantis tried to sent these emails, it failed, and they were left in the queue to be sent later. Repeat, ad infinitum.

We implemented a solution which checked if email had been queued for more than 30 days, and if so, delete it from the queue. I provide details of our solution in the Additional Information section below, in case it is of use to the Mantis dev team. Or perhaps some other solution can be implemented to prevent "unsendable" emails from remaining in the email queue indefinitely.

Steps To Reproduce

Unknown. Perhaps try to sent a Mantis email to an incorrectly-formatted email address.

Additional Information

In ./core/email_api.php, function email_send_all, make the following change (i.e. the else clause) to dequeue emails which have not been sent within 30 days:

if( !$t_email_sent ) {

    if( $p_delete_on_failure ) {
        email_queue_delete( $t_email_data->email_id );
    }
    else {
        # [cbspencer 2018-01-26] If email has been in queue for too long (i.e. repeated 
        # send failures), then there's obviously a problem, so just delete it.
        # Justification: I recently found some messages which have been enqueued since 2013,
        # but which have failed to send due to invalid email address.
        # The cut-off time below of 2592000 seconds is 30 days.
        $t_diff = time() - $t_email_data->submitted;

        if( $t_diff > 2592000 ) {
            log_event( LOG_EMAIL, "Message #$t_id failed to send after 30 days, " .
                "and is considered to have expired." );
            email_queue_delete( $t_email_data->email_id );
        }
                   # end of solution

}

TagsNo tags attached.

Relationships

related to 0016070 closedvboctor Delay due to Mantis trying sending emails to non existent address 

Activities

atrol

atrol

2018-04-04 13:52

developer   ~0059432

This is fixed in 2.13.0, see 0016070 for it.