User A from inside Organization works perfectly.
User B from outside Organization (different domain $rtname) creates a new ticket upon reply.
I have extracted the below lines from log file adding printing ID each time to know the moment when the ID is lost:
Any idea?
[18416] [Tue Feb 2 10:37:55 2021] [debug]: ID: ‘453’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:133)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: Converting ‘utf-8’ to ‘utf-8’ for text/plain - Subjectless message (/opt/rt4/sbin/…/lib/RT/I18N.pm:290)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: Converting ‘utf-8’ to ‘utf-8’ for text/html - Subjectless message (/opt/rt4/sbin/…/lib/RT/I18N.pm:290)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: Encode::Guess guessed encoding: ascii (/opt/rt4/sbin/…/lib/RT/I18N.pm:567)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: Encode::Guess guessed encoding: ascii (/opt/rt4/sbin/…/lib/RT/I18N.pm:567)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: Mail from user #155 (randomemail@gmail.com) (/opt/rt4/sbin/…/lib/RT/Interface/Email/Auth/MailFrom.pm:94)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: ID: ‘’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:133)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: Tried to load a bogus ticket id: ‘’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:141)
[18428] [Tue Feb 2 10:38:48 2021] [debug]: ID: ‘454’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:133)
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8"><d=
iv dir=3D"ltr">SENDER REPLY-2 <div class=3D"gmail_quote"><div dir=
=3D"ltr" class=3D"gmail_attr">Missatge de support via RT <<a href=3D"mailt=
o:my@doma.in">my@doma.in> del dia dt., 2 de febr. 2021 a les=
16:30: <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">RT-Suppo=
rt REPLY-1
One thing to bear in mind looking at that email is that it appears to have gone through a Microsoft Exchange server. Exchange is notorious for messing around with headers (or “broken” as some people prefer to think of it ), so what came into the system from Gmail might not be what you can see in those headers.
It might not be an issue in debugging this particular case, but just something to be aware of.
Thanks for the advice,
for internal Organization e-mails requesting a ticket works fine using the Microsoft Exchange/Office365.
New ticket is generated each time using external gmail users requesting a ticket.
I tested your example email and tried feeding it into my RT, I saw a bunch of warnings in RT but the email did successfully reply on the ticket who’s ID matched the subject ID.
The warnings do point to parts of the email being in very unexpected states, could be like Greenjim said were Exchange is messing with headers.
Its just strange that I don’t see the same logging as you do, which version of RT are you on?
But there is a subject in message header … I won’t blame Exchange for messing the headers in this case - at least there is no punctuation, just nice ASCII . Well maybe after the steps below which shows us what happened to the mail at the end.
I assume the whole mail pipe setup is something like: postfix → procmail (or similar such as maildrop or sieve) → rt-mailgate
So what says the mail.log and what says procmail.log? You’ve already posted what RT (rt-mailgate) says but maybe that’s not enough.
BTW you are using postfix so it would be maybe helpful to set in main.cf to show in mail.log some more details:
header_checks = regexp:/etc/postfix/header_checks
The header_checks file could be (cat /etc/postfix/header_checks):
/^X-RT-Ticket:/ INFO
/^Subject:/ INFO
It could be also useful to update all perl modules in the system or at least the ones responsible for decoding the e-mail. But do it rather in some testing environment
Hi Petr,
I did your proposed actions on postfix, the result of
Requesting Ticket → Replying Ticket From RT-Manager → Re-Replaying to Manager From Requester
Seems the ticked ID is lost when rt-mailgate injects a reply to a existent ticket of the external user
START: REQUEST TICKET from Requester
feb 16 10:41:26 vmwebsrv00 postfix/pickup[6323]: 9238C10275B: uid=30 from=
feb 16 10:41:26 vmwebsrv00 postfix/cleanup[6327]: 9238C10275B: info: header Subject: [General: #468] AutoReply: TEST-1 from local; from=websrv00@my.domain
feb 16 10:41:26 vmwebsrv00 postfix/cleanup[6327]: 9238C10275B: info: header X-RT-Ticket: MY RT SITE NAME #468 from local; from=websrv00@my.domain
feb 16 10:41:26 vmwebsrv00 postfix/cleanup[6327]: 9238C10275B: message-id=<rt-4.4.2-27606-1613468486-244.468-7-0@my_rt_site_name>
feb 16 10:41:26 vmwebsrv00 postfix/cleanup[6327]: 9238C10275B: info: header Subject: AutoReply: TEST-1 from local; from=websrv00@my.domain
feb 16 10:41:26 vmwebsrv00 postfix/qmgr[6322]: 9238C10275B: from=websrv00@my.domain, size=2566, nrcpt=1 (queue active)
feb 16 10:41:27 vmwebsrv00 postfix/smtp[6329]: 9238C10275B: to=mygmailuser@gmail.com, relay=gmail-smtp-in.l.google.com[74.125.140.26]:25, delay=0.98, delays=0.04/0.02/0.58/0.34, dsn=2.0.0, status=sent (250 2.0.0 OK 1613468487 l26si1668871wmh.213 - gsmtp)
feb 16 10:41:27 vmwebsrv00 postfix/qmgr[6322]: 9238C10275B: removed
REPLY-1 from RT-Management web page
feb 16 10:51:31 vmwebsrv00 postfix/pickup[6323]: 488DE10275B: uid=30 from=
feb 16 10:51:31 vmwebsrv00 postfix/cleanup[6366]: 488DE10275B: info: header Subject: [General: #468] TEST-1 from local; from=websrv00@my.domain
feb 16 10:51:31 vmwebsrv00 postfix/cleanup[6366]: 488DE10275B: message-id=<rt-4.4.2-27606-1613469091-1640.468-5-0@my_rt_site_name>
feb 16 10:51:31 vmwebsrv00 postfix/cleanup[6366]: 488DE10275B: info: header X-RT-Ticket: MY RT SITE NAME #468 from local; from=websrv00@my.domain
feb 16 10:51:31 vmwebsrv00 postfix/qmgr[6322]: 488DE10275B: from=websrv00@my.domain, size=1254, nrcpt=1 (queue active)
feb 16 10:51:32 vmwebsrv00 postfix/smtp[6368]: 488DE10275B: to=mygmailuser@gmail.com, relay=gmail-smtp-in.l.google.com[74.125.140.27]:25, delay=0.87, delays=0.05/0.02/0.36/0.44, dsn=2.0.0, status=sent (250 2.0.0 OK 1613469092 h9si2235639wrr.9 - gsmtp)
feb 16 10:51:32 vmwebsrv00 postfix/qmgr[6322]: 488DE10275B: removed
RE-REPLAY-1 from Requester GENERATING A NEW TICKET AND NEW E-MAIL FOR THE Requester
feb 16 10:54:40 vmwebsrv00 postfix/pickup[6323]: 5556C10275B: uid=30 from=
feb 16 10:54:40 vmwebsrv00 postfix/cleanup[6371]: 5556C10275B: info: header X-RT-Ticket: MY RT SITE NAME #469 from local; from=websrv00@my.domain
feb 16 10:54:40 vmwebsrv00 postfix/cleanup[6371]: 5556C10275B: message-id=<rt-4.4.2-27620-1613469280-919.469-7-0@my_rt_site_name>
feb 16 10:54:40 vmwebsrv00 postfix/cleanup[6371]: 5556C10275B: info: header Subject: [General: #469] AutoReply: Re: [General: #468] TEST-1 from local; from=websrv00@my.domain
feb 16 10:54:40 vmwebsrv00 postfix/cleanup[6371]: 5556C10275B: info: header Subject: AutoReply: Re: [General: #468] TEST-1 from local; from=websrv00@my.domain
feb 16 10:54:40 vmwebsrv00 postfix/qmgr[6322]: 5556C10275B: from=websrv00@my.domain, size=3275, nrcpt=1 (queue active)
feb 16 10:54:40 vmwebsrv00 postfix/smtp[6374]: 5556C10275B: to=mygmailuser@gmail.com, relay=gmail-smtp-in.l.google.com[74.125.140.27]:25, delay=0.5, delays=0.04/0.02/0.11/0.33, dsn=2.0.0, status=sent (250 2.0.0 OK 1613469280 t18si1655025wro.69 - gsmtp)
feb 16 10:54:40 vmwebsrv00 postfix/qmgr[6322]: 5556C10275B: removed
RT-MAILGATE DEBUG SESSION
[27606] [Tue Feb 16 10:10:10 2021] [debug]: Converting ‘utf-8’ to ‘utf-8’ for text/plain - Subjectless message (/opt/rt4/sbin/…/lib/RT/I18N.pm:290)
[27606] [Tue Feb 16 10:10:10 2021] [debug]: Converting ‘utf-8’ to ‘utf-8’ for text/html - Subjectless message (/opt/rt4/sbin/…/lib/RT/I18N.pm:290)
[27606] [Tue Feb 16 10:10:10 2021] [debug]: Encode::Guess guessed encoding: ascii (/opt/rt4/sbin/…/lib/RT/I18N.pm:567)
[27606] [Tue Feb 16 10:10:10 2021] [debug]: Encode::Guess guessed encoding: ascii (/opt/rt4/sbin/…/lib/RT/I18N.pm:567)
[27606] [Tue Feb 16 10:10:10 2021] [debug]: Mail from user #155 (mygmailuser@gmail.com) (/opt/rt4/sbin/…/lib/RT/Interface/Email/Auth/MailFrom.pm:94)
[27606] [Tue Feb 16 10:10:10 2021] [warning]: Use of uninitialized value $id in concatenation (.) or string at /opt/rt4/sbin/…/lib/RT/Ticket.pm line 133. (/opt/rt4/sbin/…/lib/RT/Ticket.pm:133)
[27606] [Tue Feb 16 10:10:10 2021] [debug]: TICKET_ID: ‘’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:133) [27606] [Tue Feb 16 10:10:10 2021] [debug]: Tried to load a bogus ticket id: ‘’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:141)
[27606] [Tue Feb 16 10:10:10 2021] [debug]: TICKET_ID: ‘470’ (/opt/rt4/sbin/…/lib/RT/Ticket.pm:133) <— GENERATE NEW ID
And this all is by mail? I am slightly confused because your logs start with from= without any address. I also miss some destination. For example my first line after connection of mailservers is
Feb 16 15:20:48 rt.mysite.cz postfix/cleanup[20902]: 1BXXXXX3E4: info: header Subject: Re: [MYQUEUETAG #123456] SOME SUBJECT from mailserver.mysite.cz[some ip address]; from=<user.address@some.mailserver.cz> to=<queuename@rt.mysite.cz> proto=ESMTP helo=<mailserver.mysite.cz>
Also I miss the log about the delivery from mailserver to RT, such as:
Or is there something else? In my live setup I have procmail in the aliases pipe so the mail is accepted by postfix, then because of aliases config delivered through pipe to procmail and then finally supplied to the rt-mailgate.
I wonder why should rt-mailgate cut the subject of the mail delivered by mail system. There has to be something before what does that.
Q1
from=wwwrun (extra characters ‘<’ and ‘>’ remove the user)
I have configured RT user in a mail client (kmail / pop3) who pipe the e-mail to a rt-server using rt-mailgate to inject the e-mail to rt-server (rt-mailgate --queue General --action correspond --url http://rt.my.domain/ ).
Q2
Yes I have my aliases:
rtuser: “|/opt/rt4/bin/rt-mailgate --queue General --action correspond --url http://rt.my.domain/”
General: “|/opt/rt4/bin/rt-mailgate --queue General --action correspond --url http://rt.my.domain/”
Q3
I will try to debug the EmailSubjectTagRegex in order to find the moment when ticket ID is lost.
Don’t include the brackets and id in $EmailSubjectTagRegex. ParseTicketId will already do that for you (in fact, it seems as if you copied the above from that function).
Change it to just Set($EmailSubjectTagRegex, qr/General/i); Or if you wanted several tags, e.g. Set($EmailSubjectTagRegex, qr/(?:Tag1|Tag2)/i);