Re: [rt-users] Sending notification / alert mails without creating comments

2013-07-29 Thread Jim Berry
Craig,

On the wiki there was a reference to an rt-remind script at  
http://www.cs.kent.ac.uk/people/staff/tdb/rt3/rt-remind, which we downloaded 
and modified for our purposes. We have several cron jobs which use it to 
nag/notify owners, requestors, and managers (hourly, daily, or weekly, 
depending on the situation).  Not optimal, but it has worked for us.

Jim

-Original Message-
From: rt-users-boun...@lists.bestpractical.com 
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Craig Ringer
Sent: Sunday, July 28, 2013 11:04 PM
To: RT users
Subject: [rt-users] Sending notification / alert mails without creating comments

Hi all

I've been trying to do something that I expected to be simple with RT:
Send reminders to subscribers on a ticket *without* creating any comment or 
correspondence on the ticket. Send an email silently, in other words.

It turns out that much of RT::Action::SendEmail expects to have a current 
transaction and crashes ungracefully if there isn't one - it doesn't test to 
see if it gets a value for TransactionObj, but it fails at several points if 
the transaction is undef. It doesn't really seem to provide a way to tell it 
what group(s) you want notified except by examining the transaction either.

I can write a completely separate action to do the job but I'll have to 
duplicate much of the code in RT::Action::SendEmail to do so, and that seems 
like a maintenance nightmare. The module isn't easily extended by a subclass in 
this way because many of the interesting bits are in the Prepare method anyway.

How do others handle sending reminders and alerts, like SLA reminders?
Do you just live with the annoying comment spam in tickets? Send mail directly, 
bypassing most of RT's mail handling code?


I'm trying to find a way to reduce the amount of code duplication I need to do 
to send mail that's consistent with how RT expects other outbound mail to look 
- appropriate headers, etc.

RT::Action::SendEmail::SendMessage(...) has the comment TODO: Break this out 
to a separate module in master and has had for a very long time. Willing to 
consider a patch that does so and tries to split RT::Action::SendEmail up into 
smaller, more easily wrapped/overridden methods too?
--
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


Re: [rt-users] Sending notification / alert mails without creating comments

2013-07-29 Thread Jim Brandt
This draft documentation describes how to send notifications without 
logging a comment or reply:


https://github.com/bestpractical/rt/blob/4.0/add-rt-crontool-docs/docs/automating_rt.pod

On 7/29/13 8:51 AM, Jim Berry wrote:

Craig,

On the wiki there was a reference to an rt-remind script at
http://www.cs.kent.ac.uk/people/staff/tdb/rt3/rt-remind, which we
downloaded and modified for our purposes. We have several cron jobs
which use it to nag/notify owners, requestors, and managers (hourly,
daily, or weekly, depending on the situation). Not optimal, but it has
worked for us.

Jim

-Original Message-
From: rt-users-boun...@lists.bestpractical.com
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Craig Ringer
Sent: Sunday, July 28, 2013 11:04 PM
To: RT users
Subject: [rt-users] Sending notification / alert mails without creating
comments

Hi all

I've been trying to do something that I expected to be simple with RT:
Send reminders to subscribers on a ticket *without* creating any comment
or correspondence on the ticket. Send an email silently, in other words.

It turns out that much of RT::Action::SendEmail expects to have a
current transaction and crashes ungracefully if there isn't one - it
doesn't test to see if it gets a value for TransactionObj, but it fails
at several points if the transaction is undef. It doesn't really seem to
provide a way to tell it what group(s) you want notified except by
examining the transaction either.

I can write a completely separate action to do the job but I'll have to
duplicate much of the code in RT::Action::SendEmail to do so, and that
seems like a maintenance nightmare. The module isn't easily extended by
a subclass in this way because many of the interesting bits are in the
Prepare method anyway.

How do others handle sending reminders and alerts, like SLA reminders?
Do you just live with the annoying comment spam in tickets? Send mail
directly, bypassing most of RT's mail handling code?


I'm trying to find a way to reduce the amount of code duplication I need
to do to send mail that's consistent with how RT expects other outbound
mail to look - appropriate headers, etc.

RT::Action::SendEmail::SendMessage(...) has the comment TODO: Break
this out to a separate module in master and has had for a very long
time. Willing to consider a patch that does so and tries to split
RT::Action::SendEmail up into smaller, more easily wrapped/overridden
methods too?
--
  Craig Ringer http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training  Services



--



Re: [rt-users] Sending notification / alert mails without creating comments

2013-07-29 Thread Craig Ringer
On 07/29/2013 08:51 PM, Jim Berry wrote:
 Craig,
 
 On the wiki there was a reference to an rt-remind script at 
 http://www.cs.kent.ac.uk/people/staff/tdb/rt3/rt-remind, which we
 downloaded and modified for our purposes. We have several cron jobs
 which use it to nag/notify owners, requestors, and managers (hourly,
 daily, or weekly, depending on the situation).  Not optimal, but it
 has worked for us. 

Thanks for the tip. That script doesn't fit my needs as I need
notifications on the order of minutes not hours, individual mails for
each ticket, and really want them triggered from rt-crontool via
TicketSQL searches. It's certainly interesting.

I haven't had the same issues with my SMS notifications because the code
for them _expects_ to have to collect its own recipient list, doesn't
care about the squashed recipient list, doesn't care about RT's custom
email headers, and knows how to deliver SMSes directly.

For email I'd rather avoid duplicating all the stuff RT already does in
these areas - correctly handling squashing, adding the RT specific
headers for loop control, ticket ID, appropriate Referer headers, etc.

I think I'm going to have to refactor RT::Action::SendEmail pretty
heavily. With luck the BestPractical team might accept a patch if I can
do it without breaking things that wrap it while still making it re-usable.

-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


[rt-users] Sending notification / alert mails without creating comments

2013-07-28 Thread Craig Ringer
Hi all

I've been trying to do something that I expected to be simple with RT:
Send reminders to subscribers on a ticket *without* creating any comment
or correspondence on the ticket. Send an email silently, in other words.

It turns out that much of RT::Action::SendEmail expects to have a
current transaction and crashes ungracefully if there isn't one - it
doesn't test to see if it gets a value for TransactionObj, but it fails
at several points if the transaction is undef. It doesn't really seem to
provide a way to tell it what group(s) you want notified except by
examining the transaction either.

I can write a completely separate action to do the job but I'll have to
duplicate much of the code in RT::Action::SendEmail to do so, and that
seems like a maintenance nightmare. The module isn't easily extended by
a subclass in this way because many of the interesting bits are in the
Prepare method anyway.

How do others handle sending reminders and alerts, like SLA reminders?
Do you just live with the annoying comment spam in tickets? Send mail
directly, bypassing most of RT's mail handling code?


I'm trying to find a way to reduce the amount of code duplication I need
to do to send mail that's consistent with how RT expects other outbound
mail to look - appropriate headers, etc.

RT::Action::SendEmail::SendMessage(...) has the comment TODO: Break
this out to a separate module in master and has had for a very long
time. Willing to consider a patch that does so and tries to split
RT::Action::SendEmail up into smaller, more easily wrapped/overridden
methods too?
-- 
 Craig Ringer   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services