<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Thomas,<br><br>It is very strange.&nbsp; I ran your code after changing email addresses and my file name and it worked.&nbsp; 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>&lt;thomas@brightbill.net&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Thomas Brightbill &lt;thomas@brightbill.net&gt;<br>Subject: Re: [sf-perl] MIME::Lite<br>To: "San Francisco Perl Mongers User Group" &lt;sanfrancisco-pm@pm.org&gt;<br>Date: Friday, July 24, 2009, 12:46 AM<br><br><div class="plainMail"><br>Peter Loo wrote:<br><br>&gt;&nbsp;&nbsp;&nbsp;my $fileName = "stravinsky09.gif";<br>&gt;&nbsp;&nbsp;&nbsp;my $datDir = "/the/path/to/my/file";<br><br>&gt;&nbsp;&nbsp;&nbsp;$message-&gt;attach ( Type&nbsp;
 &nbsp;&nbsp;&nbsp;=&gt; 'application/gif',<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Path&nbsp; &nbsp;&nbsp;&nbsp;=&gt; $datDir,<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #Encoding =&gt; 'base64',<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Filename =&gt; $fileName,<br>&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Disposition =&gt; 'attachment' );<br><br>I've used MIME::Lite a couple times but have never run across this before.&nbsp; I would suggest changing 'Path' as follows<br><br>&nbsp; Path =&gt; $datDir/$filename,<br><br>The MIME::Lite documentation says<br><br>&nbsp; Path<br><br>&nbsp; &nbsp; Alternative to "Data" or "FH". Path to a file containing the<br>&nbsp; &nbsp; data... actually, it can be any open()able expression. If it<br>&nbsp; &nbsp; looks like a path, the last element will
 automatically be<br>&nbsp; &nbsp; 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>&nbsp; $msg-&gt;send('smtp','localhost', Debug=&gt;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-&gt;new(<br>&nbsp; &nbsp; From&nbsp; &nbsp; =&gt;'<a ymailto="mailto:thomas@brightbill.net" href="/mc/compose?to=thomas@brightbill.net">thomas@brightbill.net</a>',<br>&nbsp; &nbsp; To&nbsp; &nbsp; &nbsp; =&gt;'<a ymailto="mailto:thomas@brightbill.net" href="/mc/compose?to=thomas@brightbill.net">thomas@brightbill.net</a>',<br>&nbsp; &nbsp; Subject =&gt;'A message with 2 parts...',<br>&nbsp; &nbsp; Type&nbsp; &nbsp;
 =&gt;'multipart/mixed'<br>);<br><br>### Add the text message part:<br>### (Note that "attach" has same arguments as "new"):<br>$msg-&gt;attach(<br>&nbsp; &nbsp; Type&nbsp; &nbsp;&nbsp;&nbsp;=&gt;'TEXT',<br>&nbsp; &nbsp; Data&nbsp; &nbsp;&nbsp;&nbsp;=&gt;"Here's the spreadsheet file you wanted"<br>);<br><br>### Add the spreadsheet:<br>$msg-&gt;attach(<br>&nbsp; &nbsp; Type&nbsp; &nbsp; &nbsp; &nbsp; =&gt;'application/vnd.ms-excel',<br>&nbsp; &nbsp; Path&nbsp; &nbsp; &nbsp; &nbsp; =&gt;'/home/thomas/testfile.xls',<br>&nbsp; &nbsp; Filename&nbsp; &nbsp; =&gt;'testfile.xls',<br>&nbsp; &nbsp; Disposition =&gt; 'attachment'<br>);<br><br>$msg-&gt;send('smtp','localhost', Debug=&gt;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>