开发者

Perl & MIME::Lite - Why are my .txt attachments blank?

I've been using MIME::Lite for a short while now and have had no issues until now.

I'm trying to attach a .txt file, but the file (after sent) has no content inside of it.

I know the file has something in it because I'm creating the .txt file within the same script. I know whe开发者_StackOverflow中文版re the file is and can see its contents, but when I tell MIME::Lite to attach the .txt file, the email comes in with just the file name and is only 64 bytes.

Here's the code for the MIME::Lite portion of my script:

$msg = new MIME::Lite(From => $from,To => $to,Subject => $subject,Data => "Data",Type => "multipart/mixed",); 
$msg->attach(Type => 'TEXT', Data => @message);
$msg->attach(Type => 'TEXT', Path => $stat_file);
$msg->send();

Where $stat_file = /in/some/dir/cheese/txt/somefile.txt

Everything works fine except for the 3rd line. It is correctly finding & attaching the file that I'm pointing to, but when it hits my email, its a blank .txt file of 64 bytes.

I've tried several variations of each of the first 3 lines of this code, but don't know what I'm missing.

Anyone see a reason that this script would perform as explained?


You say you're creating the file pointed to by $stat_file in your program, right? Maybe you haven't closed the filehandle to that file, and possibly it's not being flushed out to disk?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜