[rt-users] Custom Template

Rey Paderna rpaderna at valueclick.com
Thu Oct 6 12:52:39 EDT 2005


Thanks so much Ruslan!  You are correct: I forgot the fact that RT uses 
"strict".  It works now.

Its been a privilege to be advised by a Perl master!

Thanks again.



On Wednesday 05 October 2005 19:52, Ruslan Zakirov wrote:
> On 10/6/05, Rey Paderna <rpaderna at valueclick.com> wrote:
> > Hello List,
> >
> > I'm new to RT and am currently stuck.  I'm creating a custom AutoReply
> > template that needs to access a mysql db on another machine.  I read that
> > RT uses Text::Template so I am allowed to embed perl code in it.  Since
> > I'm a newbiem I didn't want to delve with scrips yet.  Here is my
> > template:
> >
> > ----START----
> > Subject: AutoReply: {$Ticket->Subject}
> >
> >
> > Hello,
> >
> > Thank you for ....blah..blah..
> >
> > {
> > use DBI;
> > $dbh=DBI->connect("DBI:mysql:db_name:1.2.3.4","user","pass",RaiseError =>
> > 1}); $sth1 = $dbh->prepare (qq{Select id from transac where email =
> >       "($Transaction->CreatorObj->EmailAddress)"});
> > $sth1->execute();
> > $userid = $sth1->fetchrow_array ();
> > "$userid";
> > }
>
> IMHO code should look like(untested):
> {
>  use DBI;
>  my $dbh =
> DBI->connect("DBI:mysql:db_name:1.2.3.4","user","pass",RaiseError => 1});
>  my $sth = $dbh->prepare ("Select id from transac where email = ?");
>  $sth->execute( $Transaction->CreatorObj->EmailAddress );
>  my ($userid) = $sth->fetchrow_array();
>  "$userid";
> }
>
> > ---END---
> >
> > When I send an email, it responds back with the correct SUbject and all
> > but the body is blank.  I've been trying to solve this since this morning
> > to no avail. If anyone can point me the correct resource, I would really
> > appreciate it.  Thanks.
>
> Start from RT log, see http://wiki.bestpractical.com/?Debug
>
> > Rey
> >
> >
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Be sure to check out the RT Wiki at http://wiki.bestpractical.com
> >
> > Buy your copy of our new book, RT Essentials, today!
> >
> > Download a free sample chapter from http://rtbook.bestpractical.com
>
> --
> Best regards, Ruslan.

-- 
Rey Paderna
Hi-Speed Media, Inc.
a ValueClick Company
818.575.4738



More information about the rt-users mailing list