in reply to How to send an attachment using MIME::Lite?
You are missing the AUTO_CONTENT line, the type should be multipart/mixed, and Dispostion should be 'attachment'. I also use a second attach.
This is the code I use in production and it works wonders.
$MIME::Lite::AUTO_CONTENT_TYPE = 1; #-- create the multipart container my $msg = MIME::Lite->new ( From => $query->param('fromwho'), To => $_, Subject => $query->param('subject'), Type =>'multipart/mixed' ) or die "Error creating multipart container: $!\n"; #-- add the text message part $msg->attach ( Type => 'TEXT', Data => $query->param('message'), ) or die "Error adding the text message part: $!\n"; #-- add the ZIP file $msg->attach ( Type => 'AUTO', Path => "../".$file, Filename => $file, Disposition => 'attachment' ) or die "Error adding $file: $!\n"; $msg->send;
|
|---|