Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hey, guys!
I've been fussing with this for awhile & thought I'd ask those that know more than me. I've been using MIME::Lite::TT for automating email messages with success, but now need to add a simple text attachment. After poking about the Internet, I've cobbled the following together which sends the attachment correctly, but now I'm losing the text of the message itself:
use strict; use warnings; use MIME::Lite::TT; use Data::Dumper; send_email(); sub send_email { my $options = { INCLUDE_PATH => '.' }; my $msg = new MIME::Lite::TT( From => 'me@xyzzy.com', To => 'me@xyzzy.com', Subject => 'test message', Type => 'multipart/mixed', Template => 'template.txt', TmplOptions => $options, TmplParams => {} ); # $msg->attr('content-type' => 'multipart/mixed'); $msg->attach( Type => 'text/plain', Path => 'test.pl', Filename => 'attachment.txt', Disposition => 'attachment' ); $msg->send(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: attachments with MIME::Lite::TT?
by Khen1950fx (Canon) on Mar 03, 2012 at 10:44 UTC |