[Mimedefang] Attachment Filename

Dave O'Neill dmo at roaringpenguin.com
Fri Mar 28 09:56:39 EDT 2008

On Fri, Mar 21, 2008 at 07:06:53PM -0400, Chanan Jones wrote:
> How can I find out the name of an attachment in the filter procedure?
> I know that the filename is stored in the $fname variable, but I would
> like to know the actual filename in the working directory, which
> apparently is not the same as $fname.

You can retrieve this from the MIME::Body object within the $entity.

In the filter() callback, you're guaranteed that $entity->bodyhandle
returns a MIME::Body object, so you can just call ->path on it:

   my $real_filename = $entity->bodyhandle->path;

Dave O'Neill <dmo at roaringpenguin.com>    Roaring Penguin Software Inc.
+1 (613) 231-6599                        http://www.roaringpenguin.com/
For CanIt technical support, please mail: support at roaringpenguin.com

More information about the MIMEDefang mailing list