Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

27 lines (22 sloc) 0.528 kB
#
# checking mail From: header
#
require 'tmail'
unless ARGV[0] then
$stderr.puts "usage: ruby fromcheck.rb <mhdir>"
exit 1
end
table = {} # from-addr-spec => [count, friendly-from]
ld = TMail::MhLoader.new( ARGV[0] )
ld.each_port do |port|
mail = TMail::Mail.new( port )
addr, = mail.from_addrs
if addr then
(table[addr.spec] ||= [0, mail.friendly_from])[0] += 1
end
end
table.to_a.sort {|a,b|
b[1][0] <=> a[1][0]
}.each_with_index do |(spec,(n,from)), i|
printf "%3d %-33s %d\n", i+1, from, n
end
Jump to Line
Something went wrong with that request. Please try again.