Difference between revisions of "MailtoLinksFromTransactions"

From Request Tracker Wiki
Jump to navigation Jump to search
m (3 revisions imported)
m (Fixed formatting)
 
Line 1: Line 1:
I hate using a web browser for composing mail. I much prefer to use my
I hate using a web browser for composing mail. I much prefer to use my
regular email client when responding to RT tickets. However, browsing ticket
regular email client when responding to RT tickets. However, browsing ticket
history is better done in a web brower. I wanted to combine these needs.
history is better done in a web browser. I wanted to combine these needs.


Using the brilliant callback-mechanism in RT, I insert some mailto
Using the brilliant callback-mechanism in RT, I insert some mailto
Line 10: Line 10:
/html/Callbacks/COMPANY/Ticket/Elements/ShowTransaction/AfterDescription
/html/Callbacks/COMPANY/Ticket/Elements/ShowTransaction/AfterDescription
in my local RT directory:
in my local RT directory:
<code>
</code>


<code>% if ($Transaction->Type eq 'Correspond' or $Transaction->Type eq 'Comment' or $Transaction->Type eq 'Create') {</code>
<pre>
% if ($Transaction->Type eq 'Correspond' or $Transaction->Type eq 'Comment' or $Transaction->Type eq 'Create') {
  | &lt;a href="mailto:<% $Ticket->QueueObj->CorrespondAddress %>?subject=<% $subject|u%>&references=<% $message_id|nu %>&body=<% $content | un%>"&gt;Email reply&lt;/a&gt;
  | &lt;a href="mailto:<% $Ticket->QueueObj->CommentAddress %>?subject=<% $subject|u%>&references=<% $message_id|nu %>&body=<% $content | un%>"&gt;Email comment&lt;/a&gt;
% }


<code>
<%init>
| <a href="mailto:<% $Ticket->QueueObj->CorrespondAddress %>?subject=<% $subject|u%>&references=<% $message_id|nu %>&body=<% $content | un%>">Email reply</a></code>
my $Ticket = $Transaction->TicketObj;
 
<code>
| <a href="mailto:<% $Ticket->QueueObj->CommentAddress %>?subject=<% $subject|u%>&references=<% $message_id|nu %>&body=<% $content | un%>">Email comment</a></code>
 
<code>
% }</code>
 
<code>
<%init></code>
 
<code>
my $Ticket = $Transaction->TicketObj;</code>
 
<code>
my $subject = "[".$RT::Config->Get('rtname')." #".$Ticket->Id."] ".$Ticket->Subject;
my $subject = "[".$RT::Config->Get('rtname')." #".$Ticket->Id."] ".$Ticket->Subject;
my $content = $Transaction->Content('Quote' => 1, 'Wrap' => 75, 'Type' => 'text/plain');</code>
my $content = $Transaction->Content('Quote' => 1, 'Wrap' => 75, 'Type' => 'text/plain');
 
my $message_id = $Transaction->Message->First->GetHeader ('Message-ID') if $Transaction->Message->First;  
<code>
</%init>  
my $message_id = $Transaction->Message->First->GetHeader ('Message-ID') if $Transaction->Message->First; </code>
<%args><
 
$Transaction  
<code></%init> </code>
</%args>
 
</pre>
<code><%args></code>
 
<code>
$Transaction </code>
 
<code></%args>
</code>
----
----

Latest revision as of 06:26, 23 November 2016

I hate using a web browser for composing mail. I much prefer to use my regular email client when responding to RT tickets. However, browsing ticket history is better done in a web browser. I wanted to combine these needs.

Using the brilliant callback-mechanism in RT, I insert some mailto hyperlinks at the top of each Transaction in RT, when clicked, an email response is generated in my email client ready to be edited.

I simply created the file /html/Callbacks/COMPANY/Ticket/Elements/ShowTransaction/AfterDescription in my local RT directory:

% if ($Transaction->Type eq 'Correspond' or $Transaction->Type eq 'Comment' or $Transaction->Type eq 'Create') {
   | <a href="mailto:<% $Ticket->QueueObj->CorrespondAddress %>?subject=<% $subject|u%>&references=<% $message_id|nu %>&body=<% $content | un%>">Email reply</a>
   | <a href="mailto:<% $Ticket->QueueObj->CommentAddress %>?subject=<% $subject|u%>&references=<% $message_id|nu %>&body=<% $content | un%>">Email comment</a>
% }

<%init>
my $Ticket = $Transaction->TicketObj;
my $subject = "[".$RT::Config->Get('rtname')." #".$Ticket->Id."] ".$Ticket->Subject;
my $content = $Transaction->Content('Quote' => 1, 'Wrap' => 75, 'Type' => 'text/plain');
my $message_id = $Transaction->Message->First->GetHeader ('Message-ID') if $Transaction->Message->First; 
</%init> 
<%args><
$Transaction 
</%args>