[rt-users] Logging as comment? when Scrip emails are sent.
Paul Gregg
lists-mail-isp-rt-users at pgregg.com
Tue Oct 9 11:59:09 EDT 2001
Hi all,
I've just joined this list (but I've looked through the archives)
and didn't find anything on this, so here goes...
I setup RT2.0.7 a couple of days ago and have been testing it and everything
is working the way it should be (using Qmail, etc - see PS at end)...
However:
What I want to achieve, is when a script emails the requestor (or anyone)
I want it to add a message to the ticket saying "Emailed correspondence
to joe at public.com" as a one-liner comment... (something like those
"jesse - Broken in 2.0.6 added" lines)
How can I go about this? My 2 days of digging through the source
hasn't yet led me to that eureka point where I understand it all yet ;)
Thanks,
Paul.
PS. Qmail:
I wasn't too happy with the way that the FAQ suggested it should be setup so
I did my own (other Qmail users might recognise me as the Qmail Single UID
doc author, then again they may not!)
This setup assumes that you want to send a complete domains worth
of email to RT, e.g. your queue addresses are general at rt.domain.com
support at rt.domain.com, etc.
1. Create /var/qmail/users/assign with the contents:
+rtuser:rtuser:707:707:/var/qmail/virtualusers/rtuser:::
.
(the single . on the last line is important) 707:707 are the uid:gid of
your rtuser in /etc/passwd
and tell Qmail to use this for your domain add the line:
rt.domain.com:rtuser
to /var/qmail/control/virtualdomains (make sure rt.domain.com is in
rcpthosts as well - but make sure is is NOT in locals)
2. Run qmail-newu
3. Create the directory /var/qmail/virtualusers/rtuser:
mkdir -p /var/qmail/virtualusers/rtuser
chown rtuser.rtuser /var/qmail/virtualusers/rtuser
4. Remove the setgid flag from rt-mailgate - it doesn't need it and you
won't need anything setgid now.
chmod g-s /usr/local/rt2/rt-mailgate
5. Create a .qmail-default file in /var/qmail/virtualusers/rtuser
echo '|/usr/local/rt2/bin/rt-mailgate-tibus $LOCAL' > \
/var/qmail/virtualusers/rtuser/.qmail-default
You can see that by now we're sending *ALL* email to anything at rt.domain.com
to our new script /usr/local/rt2/bin/rt-mailgate-tibus
What is rt-mailgate-tibus? Here it is:
#!/usr/bin/perl -w
my $lvar = shift;
my $action = ""; my $nextprog = "";
$lvar =~ s/rtuser-//;
if ($lvar =~ s/-comment$//i || $lvar =~ s/comment$//i) {
$action = "comment";
} else {
$action = "correspond";
}
$nextprog = "/usr/local/rt2/bin/rt-mailgate --queue $lvar --action $action";
open(OUT, "|$nextprog");
while (<STDIN>) {
print OUT $_;
}
close(OUT);
now chmod a+rx rt-mailgate-tibus
Send a HUP to qmails and now all mails to whatever at rt.domain.com
will be passed to your RT2 system - no need to create separate .qmail-
files or .qmail-blahcomment for each list - all you have to do to make a
new queue functional is create it in RT2.
Hope this is helpful to others.
Paul Gregg.
More information about the rt-users
mailing list