When using sendmail, MIME::Lite opens a pipe to sendmail and does $self->print( \*SENDMAIL );. As you can see from the following, that sends the content of the file (as opposed to having sendmail read the file):

use strict; use warnings; use File::Basename qw( basename ); use MIME::Lite qw( ); my $msg = MIME::Lite->new( From => 'me@myhost.com', To => 'you@yourhost.com', Cc => 'some@other.com, some@more.com', Subject => 'A message with 2 parts...', Type => 'multipart/mixed' ); $msg->attach( Type => 'TEXT', Data => "Here's the file you wanted" ); $msg->attach( Type => 'application/perl', Path => $0, Filename => basename($0), Disposition => 'attachment' ); $msg->print();
Content-Transfer-Encoding: binary Content-Type: multipart/mixed; boundary="_----------=_125010106643850" MIME-Version: 1.0 X-Mailer: MIME::Lite 3.01 (F2.74; T1.27; A1.74; B3.07; Q3.07) Date: Wed, 12 Aug 2009 14:17:46 -0400 From: me@myhost.com To: you@yourhost.com Cc: some@other.com, some@more.com Subject: A message with 2 parts... This is a multi-part message in MIME format. --_----------=_125010106643850 Content-Disposition: inline Content-Length: 26 Content-Transfer-Encoding: binary Content-Type: text/plain Here's the file you wanted --_----------=_125010106643850 Content-Disposition: attachment; filename="a.pl" Content-Transfer-Encoding: base64 Content-Type: application/perl; name="a.pl" dXNlIHN0cmljdDsKdXNlIHdhcm5pbmdzOwoKdXNlIEZpbGU6OkJhc2VuYW1l IHF3KCBiYXNlbmFtZSApOwp1c2UgTUlNRTo6TGl0ZSAgICAgcXcoICk7Cgpt eSAkbXNnID0gTUlNRTo6TGl0ZS0+bmV3KAogICAgRnJvbSAgICAgICAgPT4g J21lQG15aG9zdC5jb20nLAogICAgVG8gICAgICAgICAgPT4gJ3lvdUB5b3Vy aG9zdC5jb20nLAogICAgQ2MgICAgICAgICAgPT4gJ3NvbWVAb3RoZXIuY29t LCBzb21lQG1vcmUuY29tJywKICAgIFN1YmplY3QgICAgID0+ICdBIG1lc3Nh Z2Ugd2l0aCAyIHBhcnRzLi4uJywKICAgIFR5cGUgICAgICAgID0+ICdtdWx0 aXBhcnQvbWl4ZWQnCik7CgokbXNnLT5hdHRhY2goCiAgICBUeXBlICAgICAg ICA9PiAnVEVYVCcsCiAgICBEYXRhICAgICAgICA9PiAiSGVyZSdzIHRoZSBm aWxlIHlvdSB3YW50ZWQiCik7CgokbXNnLT5hdHRhY2goCiAgICBUeXBlICAg ICAgICA9PiAnYXBwbGljYXRpb24vcGVybCcsCiAgICBQYXRoICAgICAgICA9 PiAkMCwKICAgIEZpbGVuYW1lICAgID0+IGJhc2VuYW1lKCQwKSwKICAgIERp c3Bvc2l0aW9uID0+ICdhdHRhY2htZW50JwopOwoKJG1zZy0+cHJpbnQoKTsK Cg== --_----------=_125010106643850--

That means you can safely delete the file as soon as it has been sent if you don't care about delivery problems.


In reply to Re: Synchronisation between sending mail attachments with MIME::Lite and deleting the attached files by ikegami
in thread Synchronisation between sending mail attachments with MIME::Lite and deleting the attached files by Edrich

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.