Mail body: HTML with embedded CSS

Hi all,
I’d like to change a few standard templates to HTML.

I’ve been following the instructions found in http://wiki.bestpractical.com/view/SendHTMLEmail and added the “Content-Type: text/html” special header.

Unfortunately RT issues an error while parsing the CSS part in the HTML source:

[Thu Aug 26 08:18:34 2010] [error]: Template parsing error: syntax error at temp
late line 16, near “color:#000;
background:” (/opt/rt3/bin/…/lib/RT/Template_Overlay.pm:420)

Am I missing something? Or there is no way to tell RT to accept CSS syntax? I cannot use an external style sheet because when the message gets emailed it won’t find the stylesheet on the receivers’ PC.

Any suggestions?

Thank you in advance.

Bye
Cris

Text::Template is the perl module RT uses for templates.

It uses { and } for template delimiters.

http://search.cpan.org/~mjd/Text-Template-1.45/lib/Text/Template.pm

should show you how to escape your templates - specifically:

http://search.cpan.org/~mjd/Text-Template-1.45/lib/Text/Template.pm#JavaScript

Jesse,
thank you very much for your reply!!
I had not realized that the problem was in the curly braces used in CSS syntax!

On a related note: we are using the “subject tag” in the configuration of queues. If I use the plain text templates the $rtname variable is correctly resolved to the subject tag of the originating queue, but if I use the html templates that variable is resolved to the name globally defined in RT_SiteConfig.pm. Can this be corrected?

Thank you!
Bye
Cris

-----Messaggio originale-----
Da: Jesse Vincent [mailto:jesse@bestpractical.com]
Inviato: Thursday, August 26, 2010 9:13 PM
A: Guadagnino Cristiano
Oggetto: Re: [rt-users] mail body: HTML with embedded CSS

Text::Template is the perl module RT uses for templates.

It uses { and } for template delimiters.

http://search.cpan.org/~mjd/Text-Template-1.45/lib/Text/Template.pm

should show you how to escape your templates - specifically:

http://search.cpan.org/~mjd/Text-Template-1.45/lib/Text/Template.pm#JavaScript

On a related note: we are using the “subject tag” in the
configuration of queues. If I use the plain text templates the
$rtname variable is correctly resolved to the subject tag of the
originating queue, but if I use the html templates that variable is
resolved to the name globally defined in RT_SiteConfig.pm. Can this
be corrected?

Sounds like you have an error in your template, I’ve deployed HTML
templates for a client where it works fine.

-kevin

Kevin,
I don’t really see how could they have an error: I have simply taken my text templates and put the text (via cut and paste) in between html tags.

Are you sure your client is using the “subject tag” option in their queues?

TIA
Bye
Cris

-----Messaggio originale-----
Da: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Per conto di Kevin Falcone
Inviato: Friday, August 27, 2010 7:31 PM
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] R: mail body: HTML with embedded CSSOn Fri, Aug 27, 2010 at 09:04:10AM +0200, Guadagnino Cristiano wrote:

On a related note: we are using the “subject tag” in the configuration
of queues. If I use the plain text templates the $rtname variable is
correctly resolved to the subject tag of the originating queue, but if
I use the html templates that variable is resolved to the name
globally defined in RT_SiteConfig.pm. Can this be corrected?

Sounds like you have an error in your template, I’ve deployed HTML templates for a client where it works fine.

-kevin

Kevin,
you were right.

I copied an old generation of our templates, which did not include the mods I made to adapt to subject tags.

$rtname behaves correctly: to have the subject tag in my tamplates I changed every instance of {$rtname} to {$Ticket->QueueObj->SubjectTag}.

I am sorry for the confusion!

Bye
Cris

-----Messaggio originale-----
Da: Guadagnino Cristiano
Inviato: Monday, August 30, 2010 9:31 AM
A: 'rt-users@lists.bestpractical.com’
Oggetto: R: [rt-users] R: mail body: HTML with embedded CSS

Kevin,
I don’t really see how could they have an error: I have simply taken my text templates and put the text (via cut and paste) in between html tags.

Are you sure your client is using the “subject tag” option in their queues?

TIA
Bye
Cris

-----Messaggio originale-----
Da: rt-users-bounces@lists.bestpractical.com [mailto:rt-users-bounces@lists.bestpractical.com] Per conto di Kevin Falcone
Inviato: Friday, August 27, 2010 7:31 PM
A: rt-users@lists.bestpractical.com
Oggetto: Re: [rt-users] R: mail body: HTML with embedded CSSOn Fri, Aug 27, 2010 at 09:04:10AM +0200, Guadagnino Cristiano wrote:

On a related note: we are using the “subject tag” in the configuration
of queues. If I use the plain text templates the $rtname variable is
correctly resolved to the subject tag of the originating queue, but if
I use the html templates that variable is resolved to the name
globally defined in RT_SiteConfig.pm. Can this be corrected?

Sounds like you have an error in your template, I’ve deployed HTML templates for a client where it works fine.

-kevin