> here is how i have setup the app.yaml, email.py and form.html, let me > know whats wrong ??, how should i setup handler for email.py in > app.yaml ??
OK, here's how you can do it. app.yaml: --------- handlers: - url: /send-email script: email.py - url: (.*)/ static_files: static\1/index.html upload: static/index.html - url: / static_dir: static --------- email.py: -------- from google.appengine.api import mail from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class SendEmail(webapp.RequestHandler): def post(self): user_address = self.request.get('address') if mail.is_email_valid(user_address): sender_address = 'y...@example.com' subject = 'test' body = """test email""" mail.send_mail(sender_address, user_address, subject, body) self.redirect('/form.html') application = webapp.WSGIApplication([('/send-email', SendEmail)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() -------- form.html: --------- <form action="/send-email" method="post"> Email: <input name="address" type="text"/> <input type="submit" value="Send"/> </form> --------- I didn't test it, let me know if something doesn't work. Regarding this line in your original code: # prompt user to enter a valid address You have quite a few options, the easiest one is probably to redirect to a static page containing an error message and a link back to the email form. Other options will probably involve templates or and/or some javascript. Also note that the sender_address must be the administrator of your app or the currently signed in user: http://code.google.com/appengine/docs/mail/overview.html Hope this helps. -- www.muspy.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---