[Rt-commit] rt 01/01: Add template examples to documentation

Steven Burr steve at bestpractical.com
Mon Jul 26 15:51:19 UTC 2021


This is an automated email from the git hooks/post-receive script.

steve pushed a commit to branch docs-add-template-example
in repository rt.

commit 959b4a4511128f53d5061d9684ad24e0c8640f13
Author: Steven Burr <steve at bestpractical.com>
AuthorDate: Mon Jul 26 11:50:50 2021 -0400

    Add template examples to documentation
---
 docs/customizing/templates.pod | 50 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/docs/customizing/templates.pod b/docs/customizing/templates.pod
index fdd2838487..83892e59ba 100644
--- a/docs/customizing/templates.pod
+++ b/docs/customizing/templates.pod
@@ -198,5 +198,55 @@ queues.
 You can manage queue-specific templates by visiting
 Admin -> Queues -> Select -> ... -> Templates.
 
+=head1 Examples
+
+Note: if you are copy/pasting the examples below, please make sure to remove any extra
+leading spaces. As a reference, all of the mail headers like Content-Type: should be
+flush left.
+
+The following is an example of a template that could be used to provide a standard
+signature at the end of outgoing email notifications
+
+    RT-Attach-Message: yes
+    Content-Type: text/plain
+
+    { $Transaction->Content( Type => "text/plain") }
+
+
+    ---
+    {
+        my $user = RT::User->new( $Transaction->CurrentUser );
+        $user->Load( $Transaction->Creator );
+        $OUT .= ( $user->RealName or $user->Name ) . "\n";
+        $OUT .= ( $user->EmailAddress or 'sales at acme.com' ) . "\n";
+        $OUT .= ( $user->WorkPhone or $user->MobilePhone or '555-123-4567' ) . "\n";
+        $OUT .= ( $user->Organization or 'Acme Corp' ) . "\n";
+        my $addr = $user->Address1;
+        $addr .= ("\n" . $user->Address2 . "\n") if ($addr and $user->Address2);
+        $addr .= ("\n" . $user->City . ", " . $user->State . " " . $user->Zip . "\n") if ($user->City);
+        $OUT .= ( $addr or '123 Main St. Anywhere, NY, 12345' ) . "\n";
+    }
+
+One might even imagine customizing the signature based on something about the ticket,
+such as the value of a particular custom field
+
+    RT-Attach-Message: yes
+    Content-Type: text/plain
+
+    { $Transaction->Content( Type => "text/plain") }
+
+    ---
+    {
+        my $user = RT::User->new( $Transaction->CurrentUser );
+        $user->Load( $Transaction->Creator );
+        $OUT .= ( $user->RealName or $user->Name ) . "\n";
+        $OUT .= ( $user->EmailAddress or 'sales at acme.com' ) . "\n";
+        if ($Ticket->FirstCustomFieldValue('Request Type') eq 'support') {
+           $OUT .=  "Acme Corp, IT Support Department\n";
+        } else {
+            $OUT .= "Acme Corp, Media Relations Department\n";
+        }
+    }
+
 =cut
 

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the rt-commit mailing list