Hello,
In my application, I have a 'Contact Us' page for my users to fill in
if they want to send any feedback to me.  It requiers the user to fill
in a number of fields and to provide his/her email address.  A button
'Send' is used to send the user's filled form to me.

I am using the mail api to perform this task.  The 'Send' button sends
data using AJAX  techniques to the server. The server then sends an
email to me.  The problem is: my application only accepts the
administrator email address. It does not check (as is documented if
the user is signed in or not then redirect him to sign in and back to
my application url)

My code looks like this:
class ContactusHandler (webapp.RequestHandler):
    @login_required
    def __init__(self):
        webapp.RequestHandler.__init__(self)
        self.methods = ContactusMethods()


    def get(self):
        func = None
        action = self.request.get('action')
        if action:
            if action[0] == '_':
                self.error(403) # access denied
                return
            else:
                func = getattr(self.methods, action, None)
        if not func:
            self.error(404) # file not found
            return

        else :

            args = ()
            while True:
                key = 'arg%d' % len(args)
                val = self.request.get(key)
                if val:
                    args = (simplejson.loads(val),)
                else:
                    break

            result = func(*args)

            self.response.out.write(simplejson.dumps(result))

#----------------------------------------------------------------------------------------------
class ContactusMethods:

    def Contactus(self, *args):

        FName = str( args[0][0])
        LName = str( args[0][1])
        Email = str( args[0][2])
        MessageBody = str( args[0][3])


        message = mail.EmailMessage(sender = Email, subject="My
Website")
        message.to = "<my email address>"
        message.body = MessageBody
        message.send()

Could you please advise me on what is going wrong here?



Thank you very much,
Nora
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to