Automating mail alias on queue creation


#1

Hi all. I’m trying to automate email alias creation and deletion based
on queue actions in RT and I’m wondering if anyone out there has any
thoughts or suggestions. Basically the situation is this: I’m planning
to offer RT instances to a number of user groups and I’d like to avoid
maintaining MTA email aliases each time they change their queue
configuration (create, delete, etc.).

Originally I had hoped to have the MTA handle this but after trying
Postfix, Sendmail, and Exim I’ve run out of ideas. (If interested, I
tried regexp-based aliasing to route anything of the form
"customer-queue@helpdesk.domain.tld" to RT’s gateway, but I quickly hit
limits in the various mailers’ substitution and command execution code.
I then tried a per-message-processing approach a-la Maildrop, but I
really didn’t want to be responsible for parsing every single message to
figure out what queue it needs to reach.)

My current thinking is perhaps I can use RT’s Scrip functionality to
trigger events on queue creation that will make the necessary MTA email
alias changes. For example, if a user in instance “abcd” creates a
queue called “hardware”, create a new alias called “abcd-hardware” and
pipe it to the appropriate “rt-mailgate”. The actual “rt-mailgate” will
live in a dedicated subdirectly of the form /opt/${customer}, e.g.
/opt/abcd. The problem is I can’t seem to find a way to trigger actions
based on queue creation.

If anyone has any suggestions I’d love to hear them. If there’s a
mechanism better suited to this than using a Scrip, by all means I’d
love to hear about that as well.

Thanks in advance,

Damon

P.S. I also solicited feedback from an MTA mailing list but so far
there’s been no response…

Damon T. Miller
Director of Application Services
Thinking Phone Networks
damon@thinkingphones.com
617-649-1388 (Office)


#2

Hi all. I’m trying to automate email alias creation and deletion
based
on queue actions in RT and I’m wondering if anyone out there has any
thoughts or suggestions. Basically the situation is this: I’m
planning
to offer RT instances to a number of user groups and I’d like to avoid
maintaining MTA email aliases each time they change their queue
configuration (create, delete, etc.).

If anyone has any suggestions I’d love to hear them. If there’s a
mechanism better suited to this than using a Scrip, by all means I’d
love to hear about that as well.

Thanks in advance,

Damon

P.S. I also solicited feedback from an MTA mailing list but so far
there’s been no response…

We do something similar on our dev environment.

All our developers have their own Queues to play with named after them
"Fred", “Bob”, “Sally”, etc. I didn’t want to keep creating new mail
aliases for each of these so I have one address:
devrt@domain.com

By default, this dumps tickets into the “General” queue, but uses mail
extensions (devrt+user@domain.com) to assign tickets to users’ own
queues if supplied.

The devrt alias on my MTA (I prefer Postfix / qmail) just calls an
external script (if the +user extension is present):

#!/usr/bin/perl
use strict;
use warnings;

my $extension = lc $ENV{EXT2};
open(my $mailgate, '|-', "/bin/rt-mailgate --queue '\u 

$extension’ …") or die…;

print $mailgate $_ while <>;

This seems to work well and I believe it creates tickets in the
General queue if an unknown Queue extension is given. Also, I haven’t
had to touch the MTA setup since the development environment was
setup :).

Regards,
Tom