Logging as comment? when Scrip emails are sent

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@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 :wink:

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@rt.domain.com
support@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)

  1. Run qmail-newu

  2. Create the directory /var/qmail/virtualusers/rtuser:
    mkdir -p /var/qmail/virtualusers/rtuser
    chown rtuser.rtuser /var/qmail/virtualusers/rtuser

  3. 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

  4. 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@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 () {
print OUT $_;
}
close(OUT);

now chmod a+rx rt-mailgate-tibus

Send a HUP to qmails and now all mails to whatever@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.

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@rt.domain.com
support@rt.domain.com, etc.

(lots of nifty snippage)

I wasn’t all that happy with having to use such a cumbersome system
either. Too bad my RT2 rig isn’t fully dedicated… it’s also our
special-purpose email server containing several important email accounts
and what-not.

My recommendation? Get that procedure entered into the docs as the way
to go for fully-dedicated RT2 systems. If you can come up with a
replacement for my slapdash Qmail+non-dedicated-RT2 rig, I certainly
won’t complain.

(Yes, I’m the one who wrote the Qmail+RT2 bit in the online docs. Pure
trial-and-error computing, no doubt about it.)

Karel P Kerezman, IS Admin Entercom Portland

Anything I do is purely coincidental.

In article 1002645072.27885.5.camel@zero.kgon.com you wrote:> On Tue, 2001-10-09 at 08:59, Paul Gregg wrote:

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@rt.domain.com
support@rt.domain.com, etc.

(lots of nifty snippage)

I wasn’t all that happy with having to use such a cumbersome system
either. Too bad my RT2 rig isn’t fully dedicated… it’s also our
special-purpose email server containing several important email accounts
and what-not.

My recommendation? Get that procedure entered into the docs as the way
to go for fully-dedicated RT2 systems. If you can come up with a
replacement for my slapdash Qmail+non-dedicated-RT2 rig, I certainly
won’t complain.

(Yes, I’m the one who wrote the Qmail+RT2 bit in the online docs. Pure
trial-and-error computing, no doubt about it.)

Hi,

Thanks for the reply - your instructions certainly saved me a some
time in working out what I posted earlier.

Like yourself, my “normal” addresses are non-dedicated, e.g. support@domain.com
etc… I simply have Qmail forward these to the rt.domain.com subdomain.
RT just knows to send mail as support@domain.com so it all looks nice and
tidy.

Regards,

Paul.
| Paul Gregg |T: +44 (0) 28 90424190
| Technical Director |F: +44 (0) 28 90424709
| The Internet Business Ltd |W: http://www.tibus.com
| Holywood House, Innis Court |E: info@tibus.com
| Holywood, Co Down, BT18 9HF |P: pgregg@tibus.com

why not have the script send mail to the user by way of RT?On Tue, Oct 09, 2001 at 04:59:09PM +0100, Paul Gregg wrote:

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@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 :wink:

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@rt.domain.com
support@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)

  1. Run qmail-newu

  2. Create the directory /var/qmail/virtualusers/rtuser:
    mkdir -p /var/qmail/virtualusers/rtuser
    chown rtuser.rtuser /var/qmail/virtualusers/rtuser

  3. 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

  4. 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@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 () {
print OUT $_;
}
close(OUT);

now chmod a+rx rt-mailgate-tibus

Send a HUP to qmails and now all mails to whatever@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.


rt-users mailing list
rt-users@lists.fsck.com
http://lists.fsck.com/mailman/listinfo/rt-users

http://www.bestpractical.com/products/rt – Trouble Ticketing. Free.

I don’t follow… I’m reading your message as “Why not have RT email the
requestor”?

I already have RT replying to the requestor via Scripts, but I want it to add
a single line to the end of the ticket display noting that an email was sent to
the requestors email address (and also for any other emails sent, i.e.
to queue watchers etc).

I wouldn’t want the scrip to email another email back into RT as a comment as
that would be too chunky in the display when a single oneline entry would
be better.

Hopefully this makes it clearer.

Regards,

Paul.

In article 20011010213815.K1623@pallas.fsck.com you wrote: