Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Address verifier for emailrelay
#!/usr/bin/ruby
# coding: utf-8
address = ARGV[0]
res = 0
if address !~ /\@example\.com$/ then
read_p2c, write_p2c = IO::pipe
read_c2p, write_c2p = IO::pipe
pid = fork{
read_c2p.close
write_p2c.close
require 'win32ole'
wsh = WIN32OLE.new('WScript.Shell')
Marshal::dump(wsh.popup("アドレスを確認、送信する?\r\n" + Marshal::load(read_p2c.read), 0, '', 1), write_c2p)
write_c2p.close
wsh.ole_free
}
write_c2p.close
read_p2c.close
Marshal::dump(address, write_p2c)
write_p2c.close
Process.wait(pid)
res = Marshal::load(read_c2p.read)
end
case res
when 2
print "invalid address.\r\n"
exit(2)
end
print "\r\n"
print "#{address}\r\n"
exit 1
__END__
start "emailrelay" "C:\Program Files (x86)\emailrelay\emailrelay.exe" --close-stderr --as-proxy smtp.forward.com:25 --immediate --log --pid-file "C:\Program Files (x86)\emailrelay\emailrelay.pid" --port 10025 --remote-clients --spool-dir "C:\Program Files (x86)\emailrelay\spool" --verifier "C:\cygwin\bin\ruby.exe 'C:\Program Files (x86)\emailrelay\check_address.rb'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment