[rt-users] Re: Notify with Attachments for RT3

Mike White myk_lists at yahoo.ca
Tue Sep 30 13:11:59 EDT 2003


It turns out that i needed

RT-Attach-Message: Yes


In the Admin Comment template for attachments to be attached to 
comments.  (Thanks Ruslan Zakirov!)

Mike


Mike White wrote:

> 
> 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