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 ??
app.yaml:
---------
...
...
handlers:
- url: (.*)/
static_files: static\1/index.html
upload: static/index.html
- url: /
static_dir: static
---------
email.py:
---------
from google.appengine.api import mail
class SendEmail(webapp.RequestHandler):
def post(self):
user_address = self.request.get("email_address")
if not mail.is_email_valid(user_address):
# prompt user to enter a valid address
else:
sender_address = "[email protected]"
subject = "test"
body = """test email"""
mail.send_mail(sender_address, user_address, subject, body)
---------
form.html:
---------
<form action="/SendEmail" method="POST">
Email: <input type="email_address"><input type="submit"
value="Confirm">
</form>
---------
On Dec 15, 10:03 pm, Alexander Kojevnikov <[email protected]>
wrote:
> > I'm not starting the page using template.render (), so I cannot
> > implement the way in the tutorials, i'm using static index.html... is
> > it supposed to work if i have the sendmail in form action, like this:
> > ---??
>
> > <form action="mail.cgi" method="POST"> ...
>
> No, but you can write your own handler. Use the code from the tutorial
> as a starting point.
>
> In your index.html change the form's action for example to "/send-
> email". Then in your "send-email" handler, override the post() method,
> send an email using the appengine mail API, and finally redirect back
> to the html page with:
>
> self.redirect('/your-page.html')
>
> Don't be afraid to throw in some Python code, it's really easy. Let us
> know if you have troubles setting this up.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---