#!/usr/bin/ruby

$:.unshift(File.join(File.dirname(__FILE__), 'lib'))

require 'cgi'
require 'net/smtp'
require 'time'

puts "Content-Type: text/html; charset=UTF-8\n\n"

cgi = CGI.new

message = ''

cgi.params.each_pair do |k,v|
	message  += "#{k}\n\n #{v[0]}\n\n"
end

puts "<html><head><title>Thanks</title><link rel='stylesheet' href='http://quovadisgathering.org/style.css' /><body><h1>Thanks!</h1><p>Thanks for the feedback. It really makes a difference.</p></body></html>"

Net::SMTP.start('mail.nbtsc.org', 587, 'quovadis-gathering.org','http', 'gie4aCh4', :plain) do |smtp|
      smtp.send_message "From: Quo Vadis Website <http@quovadisgathering.org>\nDate: #{Time.now.rfc822}\nSubject: feedback form\n\n#{message}", 'http@quovadis-gathering.org', 'evan@quovadisgathering.org'
end
