[rt-users] Processing attachments outside RT

pj loh optimints at gmail.com
Tue Jul 1 21:33:52 EDT 2014


Hi Emmanuel,

Thanks! Never occurred to me to use standard PERL code. Will try this out
as soon as I can.

Once again, thanks for taking time to help out.

PJ

> here is an example I used to dump tickets to files:

>

>

>       my $Attachments = $Transaction->Attachments;

>        $Attachments->OrderBy( FIELD => 'id', ORDER => 'ASC' );

>        while ( my $Attachment = $Attachments->Next ) {

>            next unless ( $Attachment->Filename );

>            my $filename = $Attachment->Filename;

>            $filename =~ s/\//-/g;

>            my $file_path = $attachments_dir."/".$Ticket->id."-".$filename;

>            open( FILE, '>' ,$file_path ) or die "Can't open $file_path:
$!\n";

>            print FILE $Attachment->OriginalContent;

>            close ( FILE );

>        }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140702/8abffbb9/attachment.htm>


More information about the rt-users mailing list