[rt-users] Putting link to attachment in email
Chris Fabri
fabric at northwestern.edu
Tue Feb 12 10:11:16 EST 2008
Greetings!
I'm attempting to put links for attachments in emails, using the
template provided here:
http://wiki.bestpractical.com/view/AddAttachmentLinksToMail,
specifically, the code for sending the link only for a given transaction
that has an attachment:
{ my $res;
my $Attachments = $Transaction->Attachments;
$Attachments->Limit( FIELD => 'Filename', OPERATOR => '!=', VALUE =>
'' );
while (my $a = $Attachments->Next) {
$res .= "New attachments:\n" unless ($res);
$res .= " ". $RT::WebURL ."/Ticket/Attachment/". $a->TransactionId
."/". $a->id ."/". $a->Filename;
}
$res;
}
It actually puts the link in mostly fine, but I have 2 issues. The
minor issue is that if the attachment has spaces in the filename, the
url "stops" at the first space. This is mainly a cosmetic issue, but
figured I'd bring it up if somebody has dealt with this.
The major issue is that for whatever template/scrip combo I apply this
to, it doesn't include any correspondence or comment that is added.
Regardless if there is an attachment link. I simply get "This
transaction appears to have no content" in the body of the message.
The attachment link shows up and works (other than the above caveat),
but I never see any content. Other ticket info that is referenced in
the template (e.g. "Owner: {$Ticket->OwnerObj->Name}") shows up fine,
but the transaction body doesn't. That's in the template as
"{$Transaction->Content()}". Once I remove the attachment link
scripting from the template, the message body works fine, so it's not an
error elsewhere.
Any input is appreciated. Thanks! chris
More information about the rt-users
mailing list