<P>I'm running rt 3.0.11 on linux, with perl 5.8.3, mySQL and apache with mod_perl. There is nothing new in the rt.log file.</P>
<P>I am running rt-crontool with the following parameters. </P>
<P>30 * * * * /opt/rt3/bin/rt-crontool --search RT::Search::ActiveTicketsInQueue --search-arg VSATFaults --condition RT::Condition::UntouchedInHours --condition-arg 2 --action RT::Action::SystemNotify --action-arg Owner,AdminCc --template-id 20</P>
<P>I got the SytemNotify and LightWeightSendEmail.pm module from the mailing list and I have copied it to RT/Action directory. However, I don't get any mails sent to the owner and AdminCC of the VSATFaults queue after creating a ticket in the queue and making sure it was untouched for 2hours. Please, what am I doing wrong? Is there a module I'm missing out. </P>
<P>PLEASE, can someone help out. Thanks.</P>
<P>The <STRONG>SystemNotify.pm</STRONG> module I'm using is:</P>
<P>RT::Action::SystemNotify><BR>package RT::Action::SystemNotify;<BR>require RT::Action::LightWeightSendMail;</P>
<P>@ISA = qw(RT::Action::LightWeightSendMail);</P>
<P># {{{ sub SetRecipients</P>
<P>=head2 SetRecipients</P>
<P>Sets the recipients of this meesage to Owner, Requestor, AdminCc, Cc or All. <BR>Explicitly B<does not> notify the creator of the transaction.</P>
<P>=cut</P>
<P>sub SetRecipients {<BR> my $self = shift;</P>
<P> my $arg = $self->Argument;</P>
<P> $arg =~ s/\bAll\b/Owner,Requestor,AdminCc,Cc/;</P>
<P> my ( @To, @PseudoTo, @Cc, @Bcc );</P>
<P><BR> if ( $arg =~ /\bRequestor\b/ ) {<BR> push ( @To, $self->TicketObj->Requestors->MemberEmailAddresses );<BR> }</P>
<P> if ( $arg =~ /\bCc\b/ ) {<BR> #If we have a To, make the Ccs, Ccs, otherwise, promote them to To<BR> if (@To) {<BR> push ( @Cc, $self->TicketObj->Cc->MemberEmailAddresses );<BR> push ( @Cc, $self->TicketObj->QueueObj->Cc->MemberEmailAddresses );<BR> }<BR> else {<BR> push ( @Cc, $self->TicketObj->Cc->MemberEmailAddresses );<BR> push ( @To, $self->TicketObj->QueueObj->Cc->MemberEmailAddresses );<BR> }<BR> }</P>
<P> if ( ( $arg =~ /\bOwner\b/ )<BR> && ( $self->TicketObj->OwnerObj->id != $RT::Nobody->id ) )<BR> {<BR> # If we're not sending to Ccs or requestors, <BR> # then the Owner can be the To.<BR> if (@To) {<BR> push ( @Bcc, $self->TicketObj->OwnerObj->EmailAddress );<BR> }<BR> else {<BR> push ( @To, $self->TicketObj->OwnerObj->EmailAddress );<BR> }</P>
<P> }</P>
<P> if ( $arg =~ /\bAdminCc\b/ ) {<BR> push ( @Bcc, $self->TicketObj->AdminCc->MemberEmailAddresses );<BR> push ( @Bcc, $self->TicketObj->QueueObj->AdminCc->MemberEmailAddresses );<BR> }</P>
<P> if ($RT::UseFriendlyToLine) {<BR> unless (@To) {<BR> push ( @PseudoTo,<BR> "'$arg of $RT::rtname Ticket #"<BR> . $self->TicketObj->id . "':;" );<BR> }<BR> }</P>
<P> #Strip the sender out of the To, Cc and AdminCc and set the <BR> # recipients fields used to build the message by the superclass.</P>
<P> $RT::Logger->debug("$self: To is ".join(",", at To));<BR> $RT::Logger->debug("$self: Cc is ".join(",", at Cc));<BR> $RT::Logger->debug("$self: Bcc is ".join(",", at Bcc));</P>
<P> @{ $self->{'To'} } = @To;<BR> @{ $self->{'Cc'} } = @Cc;<BR> @{ $self->{'Bcc'} } = @Bcc;<BR> @{ $self->{'PseudoTo'} } = @PseudoTo;<BR> return (1);<BR>}</P>
<P># }}}</P>
<P>1;<BR></RT::Action::SystemNotify><BR></P>
<P> </P>
<P>and the <STRONG>LightWeightSendEmail module </STRONG>is:</P>
<P><RT::Action::LightWeightSendEmail><BR>package RT::Action::LightWeightSendMail;<BR>require RT::Action::SendEmail;<BR>@ISA = qw(RT::Action::SendEmail);</P>
<P>=head1 NAME</P>
<P> RT::Action::LightWeightSendmail - An action which users can use to<BR> send mail out of RT (ex., in rt-crontool) without a RT::Transaction<BR> object. It can be subclassed for more specialized mail sending<BR> behavior.</P>
<P> You can pass it with an RT::Template object, but you can not use<BR> $Transaction in it because it's alwasy undef.</P>
<P>=cut</P>
<P># {{{ sub Describe<BR>sub Describe {<BR> my $self = shift;<BR> return (ref $self . " will send an email to ticket's owner.\n");<BR>}</P>
<P># }}}</P>
<P># {{{ sub Prepare<BR>sub Prepare {<BR> my $self = shift;<BR> # This actually populates the MIME::Entity fields in the Template Object<BR> <BR> unless ($self->TemplateObj) {<BR> $RT::Logger->warning("No template object handed to $self\n");<BR> }<BR> <BR> unless ($self->TicketObj) {<BR> $RT::Logger->warning("No ticket object handed to $self\n");<BR> }<BR> <BR> <BR> $self->TemplateObj->Parse(Argument => $self->Argument,<BR> TicketObj => $self->TicketObj);<BR> <BR> # Header<BR> <BR> $self->SetSubject();<BR> <BR> $self->SetSubjectToken();<BR> <BR> $self->SetRecipients(); <BR> <BR> $self->SetReturnAddress();</P>
<P> $self->SetRTSpecialHeaders();<BR> <BR> return 1;<BR> <BR>}<BR># }}}</P>
<P># {{{ sub Commit <BR>#Do what we need to do and send it out.<BR>sub Commit {<BR> my $self = shift;</P>
<P> # Go add all the Tos, Ccs and Bccs that we need to to the message to <BR> # make it happy, but only if we actually have values in those arrays.<BR> <BR> $self->SetHeader('To', join(',', @{$self->{'To'}})) <BR> if (@{$self->{'To'}});<BR> $self->SetHeader('Cc', join(',' , @{$self->{'Cc'}})) <BR> if (@{$self->{'Cc'}});<BR> $self->SetHeader('Bcc', join(',', @{$self->{'Bcc'}})) <BR> if (@{$self->{'Bcc'}});;</P>
<P> my $MIMEObj = $self->TemplateObj->MIMEObj;<BR> $MIMEObj->make_singlepart;</P>
<P> #If we don't have any recipients to send to, don't send a message;<BR> unless ($MIMEObj->head->get('To') ||<BR> $MIMEObj->head->get('Cc') || <BR> $MIMEObj->head->get('Bcc') ) {<BR> $RT::Logger->debug("$self: No recipients found. Not sending.\n");<BR> return(1);<BR> }</P>
<P> # PseudoTo (fake to headers) shouldn't get matched for message recipients.<BR> # If we don't have any 'To' header, drop in the pseudo-to header.<BR> $self->SetHeader('To', join(',', @{$self->{'PseudoTo'}}))<BR> if ( (@{$self->{'PseudoTo'}}) and (! $MIMEObj->head->get('To')));<BR> <BR> if ($RT::MailCommand eq 'sendmailpipe') {<BR> open (MAIL, "|$RT::SendmailPath $RT::SendmailArguments") || return(0);<BR> print MAIL $MIMEObj->as_string;<BR> close(MAIL);<BR> }<BR> else {<BR> unless ($MIMEObj->send($RT::MailCommand, $RT::MailParams)) {<BR> $RT::Logger->crit("$self: Could not send mail for ".$self->TransactionObj."\n");<BR> return(0);<BR> }<BR> }<BR> <BR> return (1);<BR>}<BR># }}}</P>
<P># {{{ Deal with message headers (Set* subs, designed for easy overriding)</P>
<P># {{{ sub SetRTSpecialHeaders</P>
<P># This routine adds all the random headers that RT wants in a mail message<BR># that don't matter much to anybody else.</P>
<P>sub SetRTSpecialHeaders {<BR> my $self = shift;<BR> <BR> $self->SetReferences();</P>
<P> $self->SetPrecedence();</P>
<P> $self->SetHeader('X-RT-Loop-Prevention', $RT::rtname); <BR> $self->SetHeader('RT-Ticket', $RT::rtname. " #".$self->TicketObj->id());<BR> $self->SetHeader<BR> ('Managed-by',"Request Tracker $RT::VERSION (<A href='http://www.fsck.com/projects/rt/)")'>http://www.fsck.com/projects/rt/)")</A>;</P>
<P> return();<BR>}</P>
<P># }}}</P>
<P># {{{ sub SetReturnAddress </P>
<P>sub SetReturnAddress {<BR> my $self = shift;<BR> my %args = ( is_comment => 0,<BR> @_ );</P>
<P> # From and Reply-To<BR> # $args{is_comment} should be set if the comment address is to be used.<BR> my $replyto;</P>
<P> if ($args{'is_comment'}) { <BR> $replyto = $self->TicketObj->QueueObj->CommentAddress || <BR> $RT::CommentAddress;<BR> }<BR> else {<BR> $replyto = $self->TicketObj->QueueObj->CorrespondAddress ||<BR> $RT::CorrespondAddress;<BR> }</P>
<P> unless ($self->TemplateObj->MIMEObj->head->get('Reply-To')) {<BR> $self->SetHeader('Reply-To', "$replyto");<BR> }<BR>}</P>
<P># }}}</P>
<P># {{{ sub SetSubject</P>
<P>sub SetSubject {<BR> my $self = shift;</P>
<P> my $subject = $self->{'Subject'} || "An email from RT";<BR> $self->SetHeader('Subject', $subject);</P>
<P> return $subject;<BR>}</P>
<P># }}}</P>
<P>1;<BR></RT::Action::LightWeightSendEmail><BR></P><p>
<hr size=1> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="http://uk.rd.yahoo.com/mail/taglines/default/messenger/*http://uk.messenger.yahoo.com"><strong><font face="Arial, Helvetica, sans-serif">ALL-NEW
Yahoo! Messenger</font></strong></a><font face="Arial, Helvetica, sans-serif"><strong>
- all new features - even more fun!</strong></font><strong><font color="#FF9900">
</font></strong></font>