[rt-users] Custom Template

Ruslan Zakirov ruslan.zakirov at gmail.com
Wed Oct 5 22:52:22 EDT 2005


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.



More information about the rt-users mailing list