Queue still being CC'ed with $ParseNewMessageForTicketCcs and $RTAddressRegexp

I received a request to ‘auto CC’ clients on tickers (as our customers are only allowed to interface via email). I enabled $ParseNewMessageForTicketCcshttps://rt-wiki.bestpractical.com/wiki/ParseNewMessageForTicketCcs. We then started getting random RT Bounce messages, and upon investigating I found: https://rt-wiki.bestpractical.com/wiki/RTAddressRegexp . Due to the randomness of the email formats and the quantity of queues, I couldn’t write a simple regular expression so I have a somewhat large one:

Set($RTAddressRegexp, ‘(local-part1@domain1.tld)|
(local-part2@domain2.tld)|
(local-part3@domain3.tld)|
:
:
(local-partN@domainN.tld)/ximailto:local-partN@domainN\.tld)/xi’);

However, when a queue is added as a CC, it still gets added & a user created. When I use https://regex101.com/ , the matching works. Can I not do multi-line regexp in the SiteConfig file? I’m thinking this is something simple I’m overlooking. Thank you in advance.

Stephen Cena
Senior Systems Administrator
Quality Vision International, Inc.
Phone: (585) 544-0450 x300
To notify helpdesk: http://helpdesk.ogp.qvii.com or email: hd-general@qvii.commailto:hd-general@qvii.com
To report email issues: postmaster@qvii.commailto:postmaster@qvii.com

It is definitely the multiline expression. If I start bringing the lines together, then the “RTAddressRegexp option in the config doesn’t match” errors start to go away. Will I just have to live with a really long line or is there a way to do multi-line regexp in the file?

Stephen Cena
Senior Systems Administrator
Quality Vision International, Inc.
Phone: (585) 544-0450 x300
To notify helpdesk: http://helpdesk.ogp.qvii.com or email: hd-general@qvii.commailto:hd-general@qvii.com
To report email issues: postmaster@qvii.commailto:postmaster@qvii.comFrom: Cena, Stephen (ext. 300)
Sent: Tuesday, January 10, 2017 3:26 PM
To: ‘rt-users@lists.bestpractical.com’ rt-users@lists.bestpractical.com
Subject: Queue still being CC’ed with $ParseNewMessageForTicketCcs and $RTAddressRegexp

I received a request to ‘auto CC’ clients on tickers (as our customers are only allowed to interface via email). I enabled $ParseNewMessageForTicketCcshttps://rt-wiki.bestpractical.com/wiki/ParseNewMessageForTicketCcs. We then started getting random RT Bounce messages, and upon investigating I found: https://rt-wiki.bestpractical.com/wiki/RTAddressRegexp . Due to the randomness of the email formats and the quantity of queues, I couldn’t write a simple regular expression so I have a somewhat large one:

Set($RTAddressRegexp, ‘(local-part1@domain1.tld)|mailto:local-part1@domain1\.tld)|
(local-part2@domain2.tld)|mailto:local-part2@domain2\.tld)|
(local-part3@domain3.tld)|mailto:local-part3@domain3\.tld)|
:
:
(local-partN@domainN.tld)/ximailto:local-partN@domainN\.tld)/xi’);

However, when a queue is added as a CC, it still gets added & a user created. When I use https://regex101.com/ , the matching works. Can I not do multi-line regexp in the SiteConfig file? I’m thinking this is something simple I’m overlooking. Thank you in advance.

Stephen Cena
Senior Systems Administrator
Quality Vision International, Inc.
Phone: (585) 544-0450 x300
To notify helpdesk: http://helpdesk.ogp.qvii.com or email: hd-general@qvii.commailto:hd-general@qvii.com
To report email issues: postmaster@qvii.commailto:postmaster@qvii.com

Set($RTAddressRegexp, ‘(local-part1@domain1.tld)|
(local-part2@domain2.tld)|
(local-part3@domain3.tld)|
:
:
(local-partN@domainN.tld)/xi’);

If you want to use the /x modifier, provide a regular expression
object, not a string:

Set($RTAddressRegexp,
qr/
(local-part1@domain1.tld)|
(local-part2@domain2.tld)|
(local-part3@domain3.tld)|
:
:
(local-partN@domainN.tld)
/xi );

Tangentially, the inner grouping ()s are not necessary here, but you
will want to anchor the regular expression to the start and end of what
it’s matching. And you’ll need to escape the “@” signs:

Set($RTAddressRegexp,
qr/
^
(
local-part1@domain1.tld
| local-part2@domain2.tld
| local-part3@domain3.tld
| :
| :
| local-partN@domainN.tld
)
$
/xi );

  • Alex

That fixed my issue. Been working brilliantly since I made that change.