in reply to Mail with attachments, but w/o writing out a file first

This reply has more to do with parsing messages with attachments rather than sending them, but...

I was recently writing some software that parses messages and separates attachments using the MIME::Entity suite of modules. I specifically had to specify not to save them out to temporary files as in the following code (note the output_to_core):

use IO::File; use MIME::Parser (); my $fh = IO::File->new('somemailfile','r'); my $parser = MIME::Parser->new(); $parser->output_to_core(1); # do everything in memory my $mail_object = eval{ $parser->parse($fh) };


Sorry this is not necessarily to the point, but I have included it in case you end up doing more than just send the attachments -- which almost always comes soon after being able to send them (ie - save a copy and read it in for later use).

my @a=qw(random brilliant braindead); print $a[rand(@a)];