On Mon, 27 Jun 2016 15:01:22 +0200
Shaun Megaw <[email protected]> wrote:
> sub filter_begin
> {
> system('cp', 'INPUTMSG', '/home/shaun');
> }
> This created a file called /home/shaun/INPUTMSG which is over written
> by each new mail
Well, yes. It's doing what you told it to do.
> Is there a way to send a copy of all mails in individual files to a
> directory?
You need to give each message a unique name. The global variable
$QueueID holds the Sendmail queue ID which is guaranteed unique
for a given host, so something like:
system('cp', 'INPUTMSG', "/home/shaun/$QueueID.eml");
would probably fit the bill.
Note that in production code, you want to check whether or not the cp
succeeded. You also need to watch out for race conditions whereby
you're taking files out of the directory at the same time as
MIMEDefang is putting them in. You probably want to copy the
file to a temporary file such as "$QueueID.eml.tmp" and then
atomically rename to "$QueueID.eml" so your archiver is never
fed half a message.
Regards,
Dianne.
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.
Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang