此代码工作正常,除了comment
: 它没有插入到消息正文中。
<div class="modal" id="feedback">
<form action="/feedback" method="POST">
<div class="modal-body">
<textarea class="input-xxlarge" name="comment" rows="3"></textarea>
</div>
<div class="modal-footer">
<a class="btn" type="submit" href="/feedback">Send</a>
</div>
</form>
</div>
class SendFeedback(webapp2.RequestHandler):
def get(self):
user = users.get_current_user()
comment = self.request.get('comment')
message = mail.EmailMessage()
message.sender = user
message.to = 'foo@bar.com'
message.subject = "Feedback from %s" % user
message.body = """
Feedback:
%s
""" % comment
message.send()
self.redirect(self.request.headers['referer'])
取决于ENCTYPE="multipart/form-data"
或%s
或什么?