
Mail::Builder::Attachment::File - Module for handling attachments from files

use Mail::Builder;
my $attachment = Mail::Builder::Attachment::File('/home/guybrush/2007_10_11_invitation.pdf','invitation.pdf','application/pdf');
$attachment->name('party_invitation.pdf');
print $attachment->serialize;
# Append the attachment to an Mail::Builder object
$mb->attachment($attachment); # this removes all other attachments
OR
$mb->attachment->add($mail);

This is a simple module for handling attachments with Mail::Builder.

my $obj = Mail::Builder::Attachment::File->new(PATH[,NAME,MIME]);
Takes the path to the attached file on the local filesystem. Optionally takes the file name as it should be diplayed in the e-mail message and a mime type.
$obj->compara(OBJECT); or $obj->compara(PATH);
Checks if two attachment objectscontain the same file. Returns true or false. The compare method does not check if the mime types and name attributes of the two objects are identical.
Instead of a Mail::Builder::Attachment::File object you can also pass a scalar value representing the path.
Returns the attachment as a MIME::Entity object.
Accessor which takes/returns the path of the file on the filesystem. The file must be readable by the current uid.
Accessor which takes/returns the name of the file as displayed in the e-mail message. If no name is provided the filename will be extracted from the path attribute.
Accessor which takes/returns the mime type of the file. If no mime type is provided the module tries to determine the correct mime type for the given filename extension. If this fails 'application/octet-stream' will be used.
Try to determine the mime type by parsing the filename.
Fetch the e-mail filename from the path attribute.

Maroš Kollár
CPAN ID: MAROS
maros [at] k-1.com
http://www.k-1.com