RTAddressRegexp

From Request Tracker Wiki
Jump to: navigation, search

$RTAddressRegexp is used to prevent RT messaging itself and generating mail loops, for example when $ParseNewMessageForTicketCcs is enabled and other. Anyway to protect you from loops and other problems you must set up this option.

In this option you MUST cover every email address that can be used to interact with RT via email. If you have aliases of redirect messages to RT from some address those also should be covered.

An example expression:

Set($RTAddressRegexp , '^help(-comment)?\@(help|admin).(example.org|ourother.domain.com)$');

Would work for a server with the names "help" and "admin" and multiple domains. This will catch:

help@help.example.org

help-comment@help.example.org
help@admin.example.org
.
.
.
help-comment@admin.ourother.domain.com

Simple way

If you don't understand perl regular expression you can use simple way:

  • collect list of addresses you must cover
  • escape . (dot), @ and + symbols with \
  • fill them into template ^(escaped address 1|escaped address 2|escaped address 3|...)$

Example:

  • addresses: bugs@my.com, bugs-comment@my.com, sales@my.com and sales-comment@my.com
  • escaped: bugs\@my.com, bugs-comment\@my.com, sales\@my.com and sales-comment\@my.com
  • regexp: ^(bugs\@my.com|bugs-comment\@my.com|sales\@my.com|sales-comment\@my.com)$
  • ^(bugs|sales)(-comment)?\@(my.com)$

As you can see this can get very long if there are several names for the server.

Regexp rules you must know

Short perl regexps rules you must know:

  • \ - is used to escape character with special meaning, like dot, @, parens and other
  • . - matches any character, so you usually should escape them
  • @ - is used to access arrays, so you escape it to match @ literaly
  • ^ and $ - match at begin and end of the string respectively, note that regexp rt\@example.com would match robert@example.com and rt@example.com.au addresses, most probably it is not what you want, use ^rt\@example.com$ regexp.
  • () - group things, often used with | to group alternatives
  • | - separator for alternative parts, note that ^rt\@foo.com|rt\@bar.com$ matches rt@foo.com.au and robert@bar.com as ^ applies to the left alternative part and $ to the right only, so you can read this expression as "address starts with rt@foo.com or ends with rt@bar.com". You must group alternatives ^(rt\@foo.com|rt\@bar.com)$
  • ? - makes previous atom optional, for example ^rt(-comment)?\@example.com$ matches rt@example.com and rt-comment@example.com

See also

EmailInterface and SiteConfig