SendingCommentsDirectlyToATicketWithPostfix

From Request Tracker Wiki
Jump to navigation Jump to search

We would like to be able to redirect a message directly from our inbox to an RT ticket, in the form ticketnumber@rthost and have it recorded on the specified ticket as a comment.

Assumptions:

  1. MTA is postfix.  Configuration is in /etc/postfix , rt-mailgate is in /usr/bin .
  2. RT is running on a virtual host, e.g.  https://helpdesk.example.com/
  3. RT's virtual host hostname is pointed to the postfix server with proper A/MX records.


Steps:

1.  create or edit the file: /etc/postfix/canonical.pcre with contents:

    /^(\d+)@helpdesk.example.com/i         ticket+${1}@helpdesk.example.com


2.  ensure the file /etc/postfix/main.cf contains:

recipient_delimiter = +
canonical_maps = pcre:/etc/postfix/canonical.pcre


3.  add to your /etc/aliases file:

ticket:                       "|/usr/sbin/rt-mailgate --extension ticket --action comment --url https://helpdesk.example.com/"


4.  Now just take care of the required postfix maintenance commands:

# postmap /etc/postfix/canonical.pcre
# newaliases
# postfix reload


From here, you can simply redirect correspondence that should have gone on a ticket by redirecting the message to e.g. 1234@helpdesk .