Last active
September 29, 2016 01:27
-
-
Save lanerjo/62c9d5a830207d1e994ab50409cef9d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
import cgi | |
import html | |
import boto.ses | |
import cgitb; cgitb.enable() #for troubleshooting | |
print("Content-Type: text/html") | |
def getdata(): | |
form = cgi.FieldStorage() | |
print form | |
name = form["name"].value | |
company = form["company"].value | |
phone = form["phone"].value | |
email = form["email"].value | |
category = form["category"].value | |
message = form["message"].value | |
return name, company, phone, email, category, message | |
#main Program | |
if __name__=="__main__": | |
try: | |
name, company, phone, email, category, message = getdata() | |
print name, company, phone, email, category, message | |
conn = boto.ses.connect_to_region('us-west-2') | |
conn.send_email( | |
source = email, | |
subject = category, | |
text_body='%r, %r, %r, %r' % (name, company, | |
phone, message), | |
to_addresses = 'admin@gmail.com' | |
) | |
except: | |
cgi.print_exception() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment