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

Fellow Monasterians,

Been using MIME::Lite for ages, but never with an attachment. I keep getting an error regardless of permissions set, type of file, location on server, etc.

#!/usr/bin/perl use strict; use CGI::Carp qw(fatalsToBrowser); use Data::Dumper; use MIME::Lite; my $msg = MIME::Lite->new( From => 'foo@bar.com', To => 'bar@foo.com', Subject => "Test", Type =>'multipart/mixed' ); $msg->attach( Type => 'text/html', Data => '<h1><i>This is a test</i></h1>' ); $msg->attach(Type =>'image/gif', Path =>'/usr/home/account/files/test.gif', Disposition => 'attachment' ); $msg->send();

And the error:

email_test.pl: /usr/home/account/files/test.gif: not readable

What should I be looking for? Is this a MIME::Lite problem or something with Unix/Apache? Thanks.


—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Replies are listed 'Best First'.
Re: MIME::Lite and attachments
by Joost (Canon) on May 24, 2007 at 21:58 UTC

      Well, for yuks, I set everything to chmod 777 and still no joy.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Re: MIME::Lite and attachments
by GrandFather (Saint) on May 24, 2007 at 21:59 UTC

    Works fine for me under Windows (with a different picture and specifying MIME::Lite->send ("smtp", "smtp.foo.com");). Check that sendmail is doing the right thing perhaps?


    DWIM is Perl's answer to Gödel

      It works fine with the second $msg->attach commented out. Definitely something with the path.


      —Brad
      "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Re: MIME::Lite and attachments
by Joost (Canon) on May 24, 2007 at 21:58 UTC
    update2: node emptied because of double post. reap if you want, but apparently, it will result in an ugly message in this spot :-)