如何阻止 Perl 的 Mail::Box::Manager 删除目录?
我正在使用 Perl 模块 Mail::Box::Manager从 Maildir 读取消息并将其移动到另一个目录中。一旦脚本完成处理 Maildir 中的邮件消息,它似乎还会删除 cur/ 和 new/ Maildir 目录,并且需要重新创建 Maildir 文件/目录。
我不希望脚本删除文件夹并重新创建 Maildir 结构。
我有一些简单的事情,例如:
#!/usr/bin/perl
use Mail::Box::Manager;
my $cnt = 0;
my $mgr = Mail::Box::Manager->new;
my $folder = $mgr->open( folder => '/home/vmail/mailfolder/',
access => 'rw',
type => 'maildir',
log => 'DEBUG',
);
foreach my $msg ( $folder->messages ) {
# ... doing some processing of $msg here, then, move the mail for storage
my $filename = $msg->filename || "NA";
$filename =~ m#(.*)/new/(.*)$#;
$mgr->moveMessage("/dir/$filename",
$folder->message($cnt),
create => 1 );
$cnt++;
}
$folder->close();
收到的任何建议。谢谢。
I'm using the Perl module Mail::Box::Manager to read messages from a Maildir and move them into another directory. Once the script has finishing processing the mail messages in the Maildir it appears to also remove the cur/ and new/ Maildir directories and the Maildir files/directories need to be recreated.
I don't want the script removing the folders and having to recreate the Maildir structure.
I have something simple like:
#!/usr/bin/perl
use Mail::Box::Manager;
my $cnt = 0;
my $mgr = Mail::Box::Manager->new;
my $folder = $mgr->open( folder => '/home/vmail/mailfolder/',
access => 'rw',
type => 'maildir',
log => 'DEBUG',
);
foreach my $msg ( $folder->messages ) {
# ... doing some processing of $msg here, then, move the mail for storage
my $filename = $msg->filename || "NA";
$filename =~ m#(.*)/new/(.*)$#;
$mgr->moveMessage("/dir/$filename",
$folder->message($cnt),
create => 1 );
$cnt++;
}
$folder->close();
Any suggestions greatly received. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加
到
$mgr->open
调用。Add
to the
$mgr->open
call.