[rt-users] Any way to turn subscription email into a .html document?

Duncan Napier dgnapier at sfu.ca
Tue Nov 4 16:49:01 EST 2014


----- Original Message -----
> I have created some RT Subscriptions, but I was wondering if there is an easy
> way to convert the subscription content into a HTML document?
> 
> The emailed subscription appears as a very nicely formatted HTML/ajax email
> in my Zimbra mail system, but I would prefer it be posted as a HTML document
> that people could access. Could the email (with MIME-encapsulated attachment
> - I believe) output be piped to a file and turned into a HTML document?  I
> am running RT 4.0.8 on CentOS 6.4 (final).

Just in case anyone is interested, I managed to do this. Here is how it was done:

1) Create a subscription as a saved search, eg "Search 1". 

2) Create an alias/es or a user account/s each with the only purpose is receiving email subscriptions (eg rt-mail-search1 at myserver.com).

3) Set up the account "rt-mail-search1 at myserver.com" to receive the subscription email from "Search1".

4) Set up a time/day for the RT subscription as frequently as you need using the Subscription management page and crontab

5) Set up a shell script to run through crontab shortly after the subscription email is delivered as follows:

# write the contents of the mailbox to a file called "subscribe" (or whatever you choose). 
# You will have to locate the mail directory for your system. 
# For example in POSTFIX it may be ~rt-mail-search1/Maildir/new/, in Sendmail it may be /var/mail/rt-mail-search1 and so on

/bin/cat Maildir/new/* > subscription

# Strip out everything between "<!DOCTYPE html>" and "<div>" (inclusive) 
# and write it to a .html file (called "search1-listing.html") - the email is a HTML-formatted text document

/bin/sed -n '/<!DOCTYPE html>/,/<div>/ p' subscription > search1-listing.html

# Copy the extracted text to the share/html directory of your server

/bin/cp search1-listing.html $rt_home/share/html

# Fix permissions so it is readable
/bin/chown apache:apache $rt_home/share/html/search1-listing.html

# Delete the email in the mailbox to await the next subscription email

/bin/rm ~rt-mail-search1/Maildir/new/*

# Clear the mason cache as is required for the rt shared folder

/bin/rm -rf $rt_home/var/mason_data/obj/*

# Your subscription is now readable to all non-admin or external users with authentication privileges

http://www.myserver.com/SelfService/search1-listing.html




More information about the rt-users mailing list