I think that your script lacks the "path" part of the file to send, as in:

my $subject = "This is the subject";

my $msg = MIME::Lite ->new(
              From      =>$fromAddress,
              To        =>$toAddress,
              Subject   =>$subject,
              Type      =>'multipart/mixed',
              Path      =>$sendfile
              );

$msg->attach  (
              Type      =>'TEXT',
              Data      =>$text
              );

$msg->attach  (
              Type      =>'application/zip',
              Encoding  =>'base64',
              Path      =>$sendfile,
              Filename  =>$sendfile
              );


$msg->send();

Here I was sending a tar gzipped file.
Where $sendfile is the full name of the file to send (including path, eg:
/home/mydir1/mydir2/this_is_an_attachment.txt

Hope it helps

Ricardo Derbes
Altec SE
Albarracín 157 - San Carlos de Bariloche
+54-2944-426892
[EMAIL PROTECTED]
----- Original Message -----
From: "Rich Fernandez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2003 4:50 PM
Subject: MIME::Lite : Can someone please point out what I'm doing wrong?


> Hello,
>
> I wrote a script which tars up a file and mails it out as a MIME
attachment.
>
> When I run it I get a message that says "no data in this part" at line 35.
A
> message does show up in my Inbox, but w/o the attachment.
> It must be something simple but I just don't see it. Here's the code:
>
> -----------------8<-------------------------------------8<----------------
--
> ----
> #!/usr/bin/perl -w
> use strict;
> use MIME::Lite;
>
> my $file = 'testfile';
>
> -e 'testfile' or exit;
>
> open(STDOUT, ">>my_send.log") or die "Can't open log file $!\n";
> print '-' x 80, "\n";
> print `date`;
> print `ls -l testfile`;
>
>
> # Tar it up...
> my @tar = ("tar", "cvf", 'testfile.tar', 'testfile');
> system(@tar) == 0 or die "my_test: failed to tar up $file! $!\n";
>
> my $data = "A message to go in the  e-mail";
>
> my $msg = MIME::Lite -> new(
>         From    => '[EMAIL PROTECTED]',
>         To      => '[EMAIL PROTECTED]',
>         Subject => 'test of MIME::Lite',
>         type    => 'multipart/mixed'
>         ) or die "my_test: Unable to create mail message $!\n";
>
> $msg -> attach(Type => 'TEXT',
>                Data => "$data") or die "my_test: Unable to create first
part
> of message $!\n";
>
> $msg -> attach(Path     => 'testfile.tar',
>                Filename => 'testfile.tar',
>                Encoding => 'base64') or die "my_test: unable to attach
> second part $!\n";
>
> $msg->send or die "Can't send $!\n";  # This is line 35
>
> unlink 'testfile'     or die "Can't remove $file file $!\n";
> unlink 'testfile.tar' or die "Can't remove tar file $!\n";
> -----------------8<-------------------------------------8<----------------
--
> ----
>
> Any help would be appreciated.
> Thanks!
>
>
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to