vsailas has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I seek wisdom, for emailing attachments through catalyst plugins. Tried 'Email::MIME' but the formatting of the files were not preserved, again opening of the attachment files are not preferred.
while ( read( $file->fh, $buf, 1024 ) ) { $fc .= $buf; } my @parts = ( Email::MIME->create( attributes => { content_type => 'application/multipart', name => 'report.doc', disposition => 'attachment', }, body => $fc, ), Email::MIME->create( attributes => { }, body => 'Hello this is a test!', ), ); $c->email( header => [ To => 'vsailas@gmail.com', Subject => 'A Sample Email for Attachment', ], parts => \@parts, );
Is there a way with which I can send email with attachments, with out opening the attachment files. Thanks in advance for any help or Guidance. -Sailas

Replies are listed 'Best First'.
Re: Catalyst email with attachments
by zentara (Cardinal) on Oct 05, 2011 at 10:16 UTC
    Is there a way with which I can send email with attachments, with out opening the attachment files

    How could that possibly be done? The attachments have to be opened for reading, for the mail program to attach them. Possibly you could zip them or tar them, so no matter what you send the content type will be the same.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Do you want to know the mime type just like file command on unix shows it's file info? File::MimeInfo will return mime type.
      use strict; use warnings; use File::MimeInfo; my $mime_type = mimetype('takeda.mp3'); print "#$mime_type#\n";
      #audio/mpeg# is it's answer. I used this module today and it seems handy.