<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Thomas,<br><br>It is very strange. I ran your code after changing email addresses and my file name and it worked. I will see why mine isn't working.<br><br>Thanks for all your help.<br><br>Peter<br><br>--- On <b>Fri, 7/24/09, Thomas Brightbill <i><thomas@brightbill.net></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Thomas Brightbill <thomas@brightbill.net><br>Subject: Re: [sf-perl] MIME::Lite<br>To: "San Francisco Perl Mongers User Group" <sanfrancisco-pm@pm.org><br>Date: Friday, July 24, 2009, 12:46 AM<br><br><div class="plainMail"><br>Peter Loo wrote:<br><br>> my $fileName = "stravinsky09.gif";<br>> my $datDir = "/the/path/to/my/file";<br><br>> $message->attach ( Type
=> 'application/gif',<br>> Path => $datDir,<br>> #Encoding => 'base64',<br>> Filename => $fileName,<br>> Disposition => 'attachment' );<br><br>I've used MIME::Lite a couple times but have never run across this before. I would suggest changing 'Path' as follows<br><br> Path => $datDir/$filename,<br><br>The MIME::Lite documentation says<br><br> Path<br><br> Alternative to "Data" or "FH". Path to a file containing the<br> data... actually, it can be any open()able expression. If it<br> looks like a path, the last element will
automatically be<br> treated as the filename. See "ReadNow" also.<br><br>In your example above, I'm wondering if it's looking for "file" as the filename.<br><br>I also found it helpful to turn on debugging with<br><br> $msg->send('smtp','localhost', Debug=>1);<br><br><br>Here's my working test script:<br><br>----------------------------------------------------------------------<br><br>#!/usr/bin/perl<br><br>use strict;<br><br>use MIME::Lite;<br><br>### Create the multipart "container":<br>my $msg = MIME::Lite->new(<br> From =>'<a ymailto="mailto:thomas@brightbill.net" href="/mc/compose?to=thomas@brightbill.net">thomas@brightbill.net</a>',<br> To =>'<a ymailto="mailto:thomas@brightbill.net" href="/mc/compose?to=thomas@brightbill.net">thomas@brightbill.net</a>',<br> Subject =>'A message with 2 parts...',<br> Type
=>'multipart/mixed'<br>);<br><br>### Add the text message part:<br>### (Note that "attach" has same arguments as "new"):<br>$msg->attach(<br> Type =>'TEXT',<br> Data =>"Here's the spreadsheet file you wanted"<br>);<br><br>### Add the spreadsheet:<br>$msg->attach(<br> Type =>'application/vnd.ms-excel',<br> Path =>'/home/thomas/testfile.xls',<br> Filename =>'testfile.xls',<br> Disposition => 'attachment'<br>);<br><br>$msg->send('smtp','localhost', Debug=>1);<br><br>----------------------------------------------------------------------<br><br>Thomas<br><br>-- Thomas Brightbill<br><a ymailto="mailto:thomas@brightbill.net" href="/mc/compose?to=thomas@brightbill.net">thomas@brightbill.net</a><br><a href="http://www.brightbill.net"
target="_blank">http://www.brightbill.net</a><br><br>_______________________________________________<br>SanFrancisco-pm mailing list<br><a ymailto="mailto:SanFrancisco-pm@pm.org" href="/mc/compose?to=SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm" target="_blank">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a><br></div></blockquote></td></tr></table><br>