python和google appengine的新手: 在python中制作页面: http://hr-china.appspot.com/contact
Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it.
#Code of contact app
import webapp2
from google.appengine.api import mail
class ContactFormHandler(webapp2.RequestHandler):
def get(self):
self.response.write('You should not open this page directly')
def post(self):
name = self.request.get('name')
email = self.request.get('email')
msg= self.request.get('message')
if name and email and msg:
mail.send_mail(sender=name+"<"+email+">",
to = "myemail@domain.com",
subject="Example form",
body=msg)
return_data = ('success')
self.response.write(return_data)
else:
self.response.write('fail')
app = webapp2.WSGIApplication([
('/contact', ContactFormHandler)
], debug=True)