in reply to Sending email attachments with a twist
Ok, now i've installed this module and figured it out at last:
Use the Part() Method just like the Body() Method and the use SendLineEnc (SendLine or print) to print to that Part of the message.
my $snd = Mail::Sender->new({ smtp => ..., from => ..., }); $snd->OpenMultipart({ to => ..., from => ..., subject =>"TEST", }) or die "Error: $Mail::Sender::Error\n"; $snd->Body(0,0,'text/plain'); $snd->SendLineEnc('TEST EMAIL'); $snd->Attach({ description => "ATTCHMENT", ctype => "text/plain", disposition => "attachment; filename=\"xyz.txt\"; type +=\"text/plain\"", }) or die die "Error: $Mail::Sender::Error\n"; $snd->Part(); $snd->SendLineEnc('CONTENT OF ATTACHED FILE'); $snd->Close;
Two more things: Please do not quote "$vars", there's something about it in perlfaq4 (`perldoc -q 'quote.*vars'`), and: I would never use a module that assumes text/html as default Content-Type for emails!
--
|
|---|