OnEmailCorrespond

From Request Tracker Wiki
Jump to navigation Jump to search

This page tries to create the dual/opposite/complement of OnWebCorrespond (should match every correspondence from email), with respect to Replies.

Here's a custom scrip condition that checks for a "Received" header in the message - if there is one, we assume we're dealing with email. If not, it's a reply entered in the web interface.

This code will cause the scrip to proceed if we're dealing with an email reply. There are cases when you may need to have a different behaviour for replies coming from emails and replies coming from Web

#### BEWARE not tested yet!
  
    my $trans = $self->TransactionObj;
  
    
    # OnCorrespond:
    return 0 unless $trans->Type eq "Correspond";
    
    # Get the message attachment
    my $msgattr = $trans->Message->First;
    
    return 0 unless $msgattr; # no message attachment - assume web UI
    
    return 1 if $msgattr->GetHeader('Received'); # email message
    
    return 0;
    
    

Riccardo Carlesso 1/Apr/11

See also AnyTransactionSource.