Mandatory subject

We receive most of our RT tickets via email. Is there a way to enforce
mandatory subjects on tickets opened via email?

thanks much, vm

We receive most of our RT tickets via email. Is there a way to
enforce mandatory subjects on tickets opened via email?
Check this thread [1] as at some point it moves to discussing this very
problem.

http://lists.bestpractical.com/pipermail/rt-users/2010-September/066537.html

Depends what you mean by mandatory.

If you mean a default, if the inbound email doesn’t have a subject, should be possible to have a create scrip that sets the ticket’s title, if it doesn’t have one.
Something like a scrip with the on create condition, then something like the following in the custom action cleanup. (not tested in any way)

my $t_subject = $self->TicketObj->Subject;
if ($t_subject eq ‘’){
$self->TicketObj->SetSubject(‘No subject given’);
}

I’d probably set the stage to transactionbatch.

If you mean don’t create a ticket, if there’s no subject, I’d suggest doing that with however you’re getting the email into RT first. As long as you’re running it through procmail, or an exim filter, or something like that. Otherwise, you’d need a scrip to send an email, and to close the ticket. Better not to create it in the first place.

Steve Anderson.

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.

This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.

I meant don’t create a ticket, if there’s no subject. I’d like bounce the
request back to sender asking to create it again with some subject.On Tue, Oct 5, 2010 at 1:11 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:

Depends what you mean by mandatory.

If you mean a default, if the inbound email doesn’t have a subject, should
be possible to have a create scrip that sets the ticket’s title, if it
doesn’t have one.
Something like a scrip with the on create condition, then something like
the following in the custom action cleanup. (not tested in any way)

my $t_subject = $self->TicketObj->Subject;
if ($t_subject eq ‘’){
$self->TicketObj->SetSubject(‘No subject given’);
}

I’d probably set the stage to transactionbatch.

If you mean don’t create a ticket, if there’s no subject, I’d suggest doing
that with however you’re getting the email into RT first. As long as you’re
running it through procmail, or an exim filter, or something like that.
Otherwise, you’d need a scrip to send an email, and to close the ticket.
Better not to create it in the first place.

Steve Anderson.

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.


As with the thread mentioned by Konstantin, a lot of it will depend on how you bring the email into RT.

If I were doing it, with the way I have RT set up, I’d just adjust the Exim filter I’m using to check for a blank subject, and send a bounce email on that. But I’m doing a bundle of filtering already. If you’re just using a mail alias with sendmail, that’s going to need more work. The thread mentioned does suggest an edit to the lib/RT/Interface/Email.pm::Gateway, to check for a subject, before it’s accepted.

Steve AndersonFrom: testwreq wreq [mailto:testwreq@gmail.com]
Sent: 05 October 2010 18:17
To: Steve Anderson
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] mandatory subject

I meant don’t create a ticket, if there’s no subject. I’d like bounce the request back to sender asking to create it again with some subject.

We are using mail alias with sendmail.On Tue, Oct 5, 2010 at 1:21 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:

As with the thread mentioned by Konstantin, a lot of it will depend on how
you bring the email into RT.

If I were doing it, with the way I have RT set up, I’d just adjust the Exim
filter I’m using to check for a blank subject, and send a bounce email on
that. But I’m doing a bundle of filtering already. If you’re just using a
mail alias with sendmail, that’s going to need more work. The thread
mentioned does suggest an edit to the lib/RT/Interface/Email.pm::Gateway, to
check for a subject, before it’s accepted.

Steve Anderson

From: testwreq wreq [mailto:testwreq@gmail.com]
Sent: 05 October 2010 18:17
To: Steve Anderson
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] mandatory subject

I meant don’t create a ticket, if there’s no subject. I’d like bounce the
request back to sender asking to create it again with some subject.

On Tue, Oct 5, 2010 at 1:11 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:
Depends what you mean by mandatory.

If you mean a default, if the inbound email doesn’t have a subject, should
be possible to have a create scrip that sets the ticket’s title, if it
doesn’t have one.
Something like a scrip with the on create condition, then something like
the following in the custom action cleanup. (not tested in any way)

my $t_subject = $self->TicketObj->Subject;
if ($t_subject eq ‘’){
$self->TicketObj->SetSubject(‘No subject given’);
}

I’d probably set the stage to transactionbatch.

If you mean don’t create a ticket, if there’s no subject, I’d suggest doing
that with however you’re getting the email into RT first. As long as you’re
running it through procmail, or an exim filter, or something like that.
Otherwise, you’d need a scrip to send an email, and to close the ticket.
Better not to create it in the first place.

Steve Anderson.

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.



This email has been scanned by Netintelligence
http://www.netintelligence.com/email


BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.


If you’re using RT 3.8.8, open up lib/RT/Interface/Email.pm (/opt/rt3/lib/RT/Interface/Email.pm on my machine)
At around line 1347, you’ll find:

my $Subject = $head->get('Subject') || '';
chomp $Subject;

if you add:

if ($Subject eq ‘’)
{
MailError(
Subject => “RT Bounce: No subject”,
Explanation => “RT couldn’t process the message below as you didn’t give a subject”,
Attach => $args{‘message’}
);

    return ( 0,
        "Failed to parse this message. No subject"
    );

}

Just after it, it should do what you want. But I’ve not tested it. Restarting RT after the edit is a good idea. Taking a copy of the file first is also a good idea, in case this screws it up.

Steve AndersonFrom: testwreq wreq [mailto:testwreq@gmail.com]
Sent: 05 October 2010 18:26
To: Steve Anderson
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] mandatory subject

We are using mail alias with sendmail.

Or saving the changed file in local/lib/RT/Interface/Email.pm instead. That
way you don’t lose the changes at the next upgrade.

Mathieu Longtin
1-514-803-8977On Tue, Oct 5, 2010 at 1:21 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:

As with the thread mentioned by Konstantin, a lot of it will depend on how
you bring the email into RT.

If I were doing it, with the way I have RT set up, I’d just adjust the Exim
filter I’m using to check for a blank subject, and send a bounce email on
that. But I’m doing a bundle of filtering already. If you’re just using a
mail alias with sendmail, that’s going to need more work. The thread
mentioned does suggest an edit to the lib/RT/Interface/Email.pm::Gateway, to
check for a subject, before it’s accepted.

Steve Anderson

From: testwreq wreq [mailto:testwreq@gmail.com]
Sent: 05 October 2010 18:17
To: Steve Anderson
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] mandatory subject

I meant don’t create a ticket, if there’s no subject. I’d like bounce the
request back to sender asking to create it again with some subject.

On Tue, Oct 5, 2010 at 1:11 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:
Depends what you mean by mandatory.

If you mean a default, if the inbound email doesn’t have a subject, should
be possible to have a create scrip that sets the ticket’s title, if it
doesn’t have one.
Something like a scrip with the on create condition, then something like
the following in the custom action cleanup. (not tested in any way)

my $t_subject = $self->TicketObj->Subject;
if ($t_subject eq ‘’){
$self->TicketObj->SetSubject(‘No subject given’);
}

I’d probably set the stage to transactionbatch.

If you mean don’t create a ticket, if there’s no subject, I’d suggest doing
that with however you’re getting the email into RT first. As long as you’re
running it through procmail, or an exim filter, or something like that.
Otherwise, you’d need a scrip to send an email, and to close the ticket.
Better not to create it in the first place.

Steve Anderson.

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.



This email has been scanned by Netintelligence
http://www.netintelligence.com/email


BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.


RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

YOU ALL ARE THE BEST!!!

I have RT 3.8.4; But hacking as suggested by Steve worked. I will be trying
replacing the changes to local/lib/RT/Interface/Email.pm

Thanks a million,
vmOn Tue, Oct 5, 2010 at 2:57 PM, Mathieu Longtin mathieu@closetwork.orgwrote:

Or saving the changed file in local/lib/RT/Interface/Email.pm instead. That
way you don’t lose the changes at the next upgrade.


Mathieu Longtin
1-514-803-8977

On Tue, Oct 5, 2010 at 1:21 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:

As with the thread mentioned by Konstantin, a lot of it will depend on
how you bring the email into RT.

If I were doing it, with the way I have RT set up, I’d just adjust the
Exim filter I’m using to check for a blank subject, and send a bounce email
on that. But I’m doing a bundle of filtering already. If you’re just using a
mail alias with sendmail, that’s going to need more work. The thread
mentioned does suggest an edit to the lib/RT/Interface/Email.pm::Gateway, to
check for a subject, before it’s accepted.

Steve Anderson

From: testwreq wreq [mailto:testwreq@gmail.com]
Sent: 05 October 2010 18:17
To: Steve Anderson
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] mandatory subject

I meant don’t create a ticket, if there’s no subject. I’d like bounce the
request back to sender asking to create it again with some subject.

On Tue, Oct 5, 2010 at 1:11 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:
Depends what you mean by mandatory.

If you mean a default, if the inbound email doesn’t have a subject, should
be possible to have a create scrip that sets the ticket’s title, if it
doesn’t have one.
Something like a scrip with the on create condition, then something like
the following in the custom action cleanup. (not tested in any way)

my $t_subject = $self->TicketObj->Subject;
if ($t_subject eq ‘’){
$self->TicketObj->SetSubject(‘No subject given’);
}

I’d probably set the stage to transactionbatch.

If you mean don’t create a ticket, if there’s no subject, I’d suggest
doing that with however you’re getting the email into RT first. As long as
you’re running it through procmail, or an exim filter, or something like
that. Otherwise, you’d need a scrip to send an email, and to close the
ticket. Better not to create it in the first place.

Steve Anderson.

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.



This email has been scanned by Netintelligence
http://www.netintelligence.com/email


BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.


RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

Changes to Email.pm worked when a ticket is created by sending email to RT .
Has anyone attempted to implement writing a scrip?

I could not get RT-Extension-MandatorySubject plugin to work for opening
tickets via the web interface. I am hoping writing scrip may work for both
the cases.

-vmOn Tue, Oct 5, 2010 at 3:30 PM, testwreq wreq testwreq@gmail.com wrote:

YOU ALL ARE THE BEST!!!

I have RT 3.8.4; But hacking as suggested by Steve worked. I will be trying
replacing the changes to local/lib/RT/Interface/Email.pm

Thanks a million,
vm
On Tue, Oct 5, 2010 at 2:57 PM, Mathieu Longtin mathieu@closetwork.orgwrote:

Or saving the changed file in local/lib/RT/Interface/Email.pm instead.
That way you don’t lose the changes at the next upgrade.


Mathieu Longtin
1-514-803-8977

On Tue, Oct 5, 2010 at 1:21 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:

As with the thread mentioned by Konstantin, a lot of it will depend on
how you bring the email into RT.

If I were doing it, with the way I have RT set up, I’d just adjust the
Exim filter I’m using to check for a blank subject, and send a bounce email
on that. But I’m doing a bundle of filtering already. If you’re just using a
mail alias with sendmail, that’s going to need more work. The thread
mentioned does suggest an edit to the lib/RT/Interface/Email.pm::Gateway, to
check for a subject, before it’s accepted.

Steve Anderson

From: testwreq wreq [mailto:testwreq@gmail.com]
Sent: 05 October 2010 18:17
To: Steve Anderson
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] mandatory subject

I meant don’t create a ticket, if there’s no subject. I’d like bounce
the request back to sender asking to create it again with some subject.

On Tue, Oct 5, 2010 at 1:11 PM, Steve Anderson < steve.anderson@bipsolutions.com> wrote:
Depends what you mean by mandatory.

If you mean a default, if the inbound email doesn’t have a subject,
should be possible to have a create scrip that sets the ticket’s title, if
it doesn’t have one.
Something like a scrip with the on create condition, then something like
the following in the custom action cleanup. (not tested in any way)

my $t_subject = $self->TicketObj->Subject;
if ($t_subject eq ‘’){
$self->TicketObj->SetSubject(‘No subject given’);
}

I’d probably set the stage to transactionbatch.

If you mean don’t create a ticket, if there’s no subject, I’d suggest
doing that with however you’re getting the email into RT first. As long as
you’re running it through procmail, or an exim filter, or something like
that. Otherwise, you’d need a scrip to send an email, and to close the
ticket. Better not to create it in the first place.

Steve Anderson.

BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.



This email has been scanned by Netintelligence
http://www.netintelligence.com/email


BiP Solutions Limited is a company registered in Scotland with Company
Number SC086146 and VAT number 383030966 and having its registered
office at Medius, 60 Pacific Quay, Glasgow, G51 1DZ.


This e-mail (and any attachment) is intended only for the attention of
the addressee(s). Its unauthorised use, disclosure, storage or copying
is not permitted. If you are not the intended recipient, please destroy
all copies and inform the sender by return e-mail.
This e-mail (whether you are the sender or the recipient) may be
monitored, recorded and retained by BiP Solutions Ltd.
E-mail monitoring/ blocking software may be used, and e-mail content may
be read at any time.You have a responsibility to ensure laws are not
broken when composing or forwarding e-mails and their contents.


RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

RT Training in Washington DC, USA on Oct 25 & 26 2010
Last one this year – Learn how to get the most out of RT!

Hi Mathieu!

We have something like that in place, using scrips.

We have a set of requests that have to be done using a web interface, and we don’t want users to be able to place requests directly through email. But for simplicity reasons the web interface, after collecting all the necessary info from the user, does exactly that: sends an email to RT.

We sorted this out this way: the PHP web page generates emails with a special custom header, and we then check the presence of this header in RT and populate a custom field (using the RT::Extension::ExtractCustomFieldValues extension).

Another (generalized) scrip then checks for the presence of ANY custom field with a “mandatory” type; if found and not populated, the ticket is automatically rejected and a reply sent to the requestor that points him to the URL for the web interface.

If you’re interested I can expand on the details.

Bye
Cris

Da: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Per conto di testwreq wreq
Inviato: Wednesday, October 06, 2010 5:40 PM
A: Mathieu Longtin
Oggetto: Re: [rt-users] mandatory subject

Changes to Email.pm worked when a ticket is created by sending email to RT . Has anyone attempted to implement writing a scrip?

I could not get RT-Extension-MandatorySubject plugin to work for opening tickets via the web interface. I am hoping writing scrip may work for both the cases.

-vmOn Tue, Oct 5, 2010 at 3:30 PM, testwreq wreq <testwreq@gmail.commailto:testwreq@gmail.com> wrote:
YOU ALL ARE THE BEST!!!

I have RT 3.8.4; But hacking as suggested by Steve worked. I will be trying replacing the changes to local/lib/RT/Interface/Email.pm

Thanks a million,
vm
On Tue, Oct 5, 2010 at 2:57 PM, Mathieu Longtin <mathieu@closetwork.orgmailto:mathieu@closetwork.org> wrote:
Or saving the changed file in local/lib/RT/Interface/Email.pm instead. That way you don’t lose the changes at the next upgrade.

Mathieu Longtin
1-514-803-8977