in reply to Re: Dealing with "Detachments"
in thread Dealing with "Detachments"
heh! I'm doing almost exactly the same thing. I tested this and it works for me:
For actual use I'd create the directory internally from the program and then remove it when finished. You'll also want to come up with some dynamic means of choosing the directory name since you don't want to try and delete the directory while another instance of the program is trying to write to it.use strict; use warnings; use MIME::Parser; ## my alias line: ## menu: \menu, "|/usr/perl/mime.parser.p" ## '\menu' keeps a copy in the inbox for account menu my $parser = new MIME::Parser; ## The secret here is that the directory must pre-exist ## and must be writable by the daemon that runs the ## parsing script. In my case user=daemon group=other ## I determined the correct values by initially making ## /tmp/mimemail using permissions 777. $parser->output_dir("/tmp/mimemail"); my $entity = $parser->read(\*STDIN) or die "\n\nCouldn't parse MIME stream\n\n";
All you have to do now is figure out how to scarf the other portions of the original message using MIME::Parser before resending with MIME::Lite.
--Jim
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Dealing with "Detachments"
by hacker (Priest) on Oct 25, 2002 at 11:09 UTC |
In Section
Seekers of Perl Wisdom