summaryrefslogtreecommitdiff
path: root/spamassassin/oftc-listmod-process-outbox
blob: 032c88b9b4149a0d36ee6287ccd5729c82397a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/ruby

OUTBOX="mail/outbox"

def check_maildir(d)
	throw "#{d} is not a maildir" unless FileTest.directory?(d)
	throw "#{d} is not a maildir" unless FileTest.directory?(d+"/new")
	throw "#{d} is not a maildir" unless FileTest.directory?(d+"/cur")
	throw "#{d} is not a maildir" unless FileTest.directory?(d+"/tmp")
	true
end

check_maildir OUTBOX

Dir[OUTBOX+"/new/*"].each do |filename|
	if system("/usr/sbin/sendmail -t -oi < #{filename}")
		File.unlink(filename)
	else
		STDERR.puts "Mailing of #{filename} failed."
	end
end