[rt-users] Notify with Attachments for RT3

Mike White myk_lists at yahoo.ca
Fri Sep 26 12:42:53 EDT 2003


Hi all,

I tried to port the excellent NotifyWithAttchment,

http://www.bestpractical.com/pub/rt/contrib/2.0/NotifyWithAttachment.tgz

to RT3 by adding the following code as Custom action preparation code to 
"On Comment Notify AdminCcs as Comment with template Admin Comment" and 
"On Correspond Notify Requestors, Ccs and AdminCcs with template 
Correspondence"

---------
my $self = shift;

$self->SUPER::Prepare() || return 0;

my $attachments = $self->TransactionObj->Attachments;
$attachments->GotoFirstItem;

my $cnt = $attachments->Count;
$RT::Logger->debug("$self: Adding $cnt atts.\n");

# skip the first one, it is already attached
# Why do I have to skip two?
$attachments->GotoItem(2);

while (my $message=$attachments->Next) {
   next unless ($message->Content);

   my $fname = $message->Filename;
   $fname =~ s/.*(\\|\/)//g;
   $RT::Logger->debug("$self: Adding attachment $fname.\n");

   $self->TemplateObj->MIMEObj->attach(Data => $message->Content,
                                       Type => $message->ContentType,
                                       Encoding => "base64",
                                       Description => $fname,
                                       Disposisiton => "attachment",
                                       Filename => $fname);
  }
---------


However, it seems to only echo out attchments for correspondance, not 
for comments.  Can anyone see anything wrong?

Thanks,
mike






More information about the rt-users mailing list