Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Attach(3)	      User Contributed Perl Documentation	     Attach(3)

NAME
       Mail::Audit::Attach - Mail::Audit plugin	for attachment handling.

SYNOPSIS
	 use Mail::Audit qw(Attach);

	 my $mail = Mail::Audit->new;

	 # ...

	 my $num_attachment = $mail->num_attachments;
	 my $attachments = $mail->attachments;

	 remove_attachments(filename =>	"\.(exe|scr|pif)",
			    smaller_than => 20000);

	 $mail->remove_attachments(mime_type =>	"text/html");

	 foreach (@$attachments) {
	     $_->save($attachdir)
		 if ($_->mime_type =~ |^image/|);
	     $_->remove
		 if ($_->filename =~ |\.(vcf)$|);
	 }

	 $mail->make_singlepart; # if possible

DEFINITION
       For the purpose of this plugin, an attachment is	a MIME part that has a
       filename. Files attached	to non-MIME messages will not be discovered.

DESCRIPTION
       This is a Mail::Audit plugin which provides easy	access to files
       attached	to mail	messages. Besides Mail::Audit, it requires the
       "MIME::Entity" module.

   CONSTRUCTOR
       "new"
	   This	constructor is called by Mail::Audit; it should	not be
	   necessary to	create a Mail::Audit::Attach object manually.

   METHODS IN MAIL::AUDIT
       "num_attachments"
	   Returns the number of attachments found

       "attachments"
	   Returns a reference to a list of attachment objects

       "error"
	   Returns a string with an error message (if an error ocurred).

       "remove_attachments"
	   Removes attachments from the	mail that match	the criteria specified
	   via the options, or all, if no options are specified. Currently,
	   the following options (hash keys) are supported:

	   "mime_type"
	   "file_name"
	       Specify a regular expression; attachments whose MIME type or
	       filename	matches	this expression	are removed.

	   "smaller_than"
	   "bigger_than"
	       Specify file size limits; attachments smaller or	bigger than
	       these limits are	removed.

	   An attachment must match all	of the criteria	to be removed. Returns
	   the number of attachments removed.

   ATTACHMENT PROPERTIES
       The attachments are a subclass of "MIME::Entity". Check out
       MIME::Entity to learn about useful methods like "mime_type" or
       "bodyhandle" that are inherited.

       "size"
	   Returns the size of the attached file.

       "filename"
	   Returns the original	filename given in the MIME headers.

       "safe_filename"
	   Returns the filename, with /\:;[]| and whitespace replaced by
	   underscores,	or 'attachment'	if the original	filename is empty.

   ATTACHMENT ACTIONS
       "remove"
	   Removes the attachment, ie. detaches	the corresponding MIME entity
	   and purges the body data.

       "save($location)"
	   Saves the attachment	as a file in $location.	If $location is	a
	   directory (ie if "-d	$location"), "save" uses "safe_filename" to
	   store the file inside that directory, else $location	is assumed to
	   be a	fully-qualified	path with filename.

	   In both cases, "save" checks	whether	the target file	exists and
	   appends '.n'	to the filename, with n	being an integer that leads to
	   a unique filename, if necessary.

	   Returns the filename	used to	save the file, or undef	if an error
	   ocurred (you	might want to take a look at
	   "Mail::Audit::Attach::error"	in that	case).

	   Note	that the attachment is not removed.

   ERROR FUNCTION
       "Mail::Audit::Attach::error" will return	an error message if an action
       failed (currently only set by "save").

HISTORY
       0.96, 2010-02-28
	       - Fixed POD bug introduced in 0.95
	       - Upgraded to Makefile.PL in the	style of Alexandr Ciornii (v0.21)

       0.95, 2010-02-26
	       - Created GitHub	repository
	       - Fixed RT#19546: Added missing dependency MIME::Base64

       0.94  Sun Jun 05	23:00:00 2005
	       - Updated distribution to more modern format.
	       - Added POD tests.

       0.93  Sat Apr 14	00:30:00 2003
	       - Mail::Audit->save died	when passed an empty location. Fixed.
		 location is now optional.
	       - Now uses File::Spec for more portability
	       - Introduced Mail::Audit::error (used by	save)
	       - Localized $_ where used

       0.92  Sat Feb  8	13:00:00 2003
		   - Now relies	on MIME::Head to recognize attachments.
		     "Never try	to be too clever."
		   - No	more warnings.

       0.91  Thu Feb  6	22:30:00 2003
	     - Now recognizes attachments with Content-Disposition inline,
	       but a given filename. This became necessary because Netscape
		   Communicator	and other clients send their attachments that way.

		     Thanks to Jeff Engelhardt and Vladimir Parkhaev for bringing
		     this to my	attention.

       0.90  Sat Jun  1	19:35:24 2002
		   - original version; created by h2xs 1.19

DEVELOPMENT NOTES
       Please report any bugs using the	CPAN RT	system.	The development
       repository for this module is hosted on GitHub:
       <http://github.com/crenz/Mail-Audit-Attach/>.

AUTHOR
       Christian Renz <crenz@web42.com>

LICENSE
       Copyright (C) 2002-2010 Christian Renz <crenz@web42.com>

       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

SEE ALSO
       Mail::Audit. MIME::Entity.

perl v5.32.1			  2010-02-28			     Attach(3)

NAME | SYNOPSIS | DEFINITION | DESCRIPTION | HISTORY | DEVELOPMENT NOTES | AUTHOR | LICENSE | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Mail::Audit::Attach&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help