summaryrefslogtreecommitdiff
path: root/scripts/postfix-generate-virtual-map
blob: d5c2d21beda5454e2f4906e266cdf8b927f2e111 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
# Usage: postfix-show-virtual-map > ${file} && postmap hash:${file}

load "#{File.dirname(__FILE__)}/common.rb"

users = load_all_users.values.find_all{|u|u["groups"].include?("email")}

users.each do |user|
	if user["email"] and user["email"].length > 0
		if user["email"][0] =~ /.*@parabola.nu$/
			if user["email"].length > 1
				puts "#{user["username"]}@parabola.nu  #{user["email"][1]}"
			end
		else
			puts "#{user["username"]}@parabola.nu  #{user["email"][0]}"
		end
	end
end