Don’t let Out-Of-Office emails change your ticket

Jens Bothe22. Oct 2010 | Modifications & Packages

Disclaimer:

The practical examples presented in our technical blog (blog.otrs.com) and now in the expert category in our FAQ blog section serve as a source of ideas and documentation to show what is theoretically possible with OTRS in concrete scenarios or sometimes even for more exotic configurations. All configurations presented here were developed under laboratory conditions as a proof of concept. 

We can only guarantee testing and implementation of these concepts to be error-free and productive if implemented in a workshop with one of our OTRS consultants. Without this, the responsibility lies with the customer himself. Please note that configurations from older OTRS versions may not work in the newer ones.

One of those situations – you’ve sent an email to a customer, put the ticket to “pending reminder” and promptly receive an reply “I’m currently out of the office but will return to you as soon as possible”…

If you want that information in the OTRS but you don’t want your ticket reopened and a don’t want a notification about it – then read on.

If your position is – I do want to be informed by the OTRS about my customer being out of the office, then please skip this article.

Idea

We use a Postmaster Filter to set a special X-OTRS-Header on subjects and signal the OTRS – do not change the status of the ticket but create a followup article on it anyway.

Prerequsites

New Sysconfig setting

You may know the procedure from my other blog postings – here is a small XML file, which provides a new SysConfig setting. Please save it in Kernel/Config/Files/OutOfOffice.xml

<?xml version="1.0" encoding="utf-8"?>
<otrs_config version="1.0" init="Application">
 <ConfigItem Name="OoO-Header" Required="0" Valid="0">
   <Description Lang="en">The X-OTRS-Header which indicates that the current status
    of a ticket should NOT be altered.</Description>
   <Description Lang="de">Der X-OTRS-Header welcher signalisiert, dass der aktuelle Status
    eines Tickets NICHT verändert wird.</Description>
   <Group>Ticket</Group>
   <SubGroup>Core::PostMaster</SubGroup>
   <Setting>
    <String Regex="">X-OTRS-OutOfOffice</String>
   </Setting>
  </ConfigItem>
</otrs_config>

If the file is in place, please rebuild the OTRS configuration by calling
perl bin/otrs.RebuildConfig.pl

Patch for Postmaster/FollowUp.pm

The attached patch has to be applied to Kernel/System/Postmaster/Followup.pm and simply checks the presence of the new Sysconfig setting and then if the specified X-OTRS-Header is set in the email.

*** Kernel/System/PostMaster/FollowUp.pm.dist   2010-10-19 23:33:14.000000000 +0200
--- Kernel/System/PostMaster/FollowUp.pm        2010-10-20 03:24:41.000000000 +0200
***************
*** 79,85 ****
      elsif ( $UserInfo{ValidID} eq 1 ) {
          # set lock (if ticket should be locked on follow up)
!         if ( $Lock && $Ticket{StateType} =~ /^close/i ) {
              $Self->{TicketObject}->LockSet(
                  TicketID => $Param{TicketID},
                  Lock     => 'lock',
--- 79,88 ----
      elsif ( $UserInfo{ValidID} eq 1 ) {
          # set lock (if ticket should be locked on follow up)
!         if ( $Lock
!             && $Ticket{StateType} =~ /^close/i
!             && !( $Self->{ConfigObject}->Get('OoO-Header') ? $GetParam{ $Self->{ConfigObject}->Get('OoO-Header') } : 0 )
!            ) {
              $Self->{TicketObject}->LockSet(
                  TicketID => $Param{TicketID},
                  Lock     => 'lock',
***************
*** 121,127 ****
          $State = $GetParam{'X-OTRS-FollowUp-State'};
      }
!     if ( $Ticket{StateType} !~ /^new/ || $GetParam{'X-OTRS-FollowUp-State'} ) {
          $Self->{TicketObject}->StateSet(
              State => $GetParam{'X-OTRS-FollowUp-State'} || $State,
              TicketID => $Param{TicketID},
--- 124,132 ----
          $State = $GetParam{'X-OTRS-FollowUp-State'};
      }
!     if ( ($Ticket{StateType} !~ /^new/ || $GetParam{'X-OTRS-FollowUp-State'})
!         && !( $Self->{ConfigObject}->Get('OoO-Header') ? $GetParam{ $Self->{ConfigObject}->Get('OoO-Header') } : 0 )
!         ) {
          $Self->{TicketObject}->StateSet(
              State => $GetParam{'X-OTRS-FollowUp-State'} || $State,
              TicketID => $Param{TicketID},

Configuration

The configuration is straight forward – create a new X-OTRS-Header, enable the patch, configure the Header to use, configure a new Postmaster Filter -> done.

SysConfig – Ticket::Postmaster

Please create a new X-OTRS-Header which will be used for the Out-Of-Office settings.

X-OTRS-Header - Out-of-Office

New X-OTRS-Header

Now enable the patch and enter the new X-OTRS-Header you just created.

Out-of-Office Header

Out-of-Office Header

Postmaster Filter

Create a new Postmaster Filter which sets the X-OTRS-Header (see above) of an incoming email based on whatever regular expression you want to use.

Postmaster Filter

Postmaster Filter

Done!

Please note: changing the OTRS sources is done on your own risk! All changes will be – most likely – lost when upgrading the system so please document everything!

Download

Here is a ZIP file containing the patch, the XML file and the screenshots used in this post -> Out of Office Patch

#5
Jens at 17.06.2014, 21:25

The same code should work on 3.3. Please note that changes are on own risk!

#4
Sebastian at 17.06.2014, 13:48

Hey, great feature and very much needed. Is there a solution within 3.3.x ??

#3
DR at 14.06.2013, 10:52

Does this work for 3.2? I tried and with me it does not.

#2
Cham at 09.05.2013, 12:09

Hi Daniel, I am a non-advanced linux user, but have been using OTRS for many years. I find the idea of stopping Out Of Office notifications from re-opening tickets VERY useful. However I have followed your instructions and are stuck on the 'enable the patch' phase. I am not getting the option to enable the Header, however X-OTRS-OutOfOffice is available in the Postmaster Filter Management area. Could you possibly let me know what I'm doing wrong? Thanks Cham

#1
Tweets that mention Don’t let Out-Of-Office emails change your ticket - OTRS Community Blog -- Topsy.com at 22.10.2010, 14:53

[...] This post was mentioned on Twitter by Jens Bothe, Daniel Ciaglia. Daniel Ciaglia said: How to ignore Out-Of-Office replies in #OTRS - http://bit.ly/aAAMEj [...]

Your email address will not be published. Required fields are marked *