I am trying out the incoming email module, and am stumped. I do the
following:

class LogSenderHandler(InboundMailHandler):
    def receive(self, mail_message):
        logging.info("Received a message from: " + mail_message.sender
+ " to: " + mail_message.to)
        text = mail_message.bodies(content_type='text/plain')
        logging.info("Message body: " + text)
        self.response.out.write('ok')

I can fetch the to/from/subject fields, but when I try to read the
message body, I get the following error. Obviously I need to do
something else, but I can't find any documentation about this. It
would be nice if Google would publish a more complete sample app that
processes inbound email. If someone has an example they can post I'd
really appreciate it. I know it should not be that difficult.

cannot concatenate 'str' and 'generator' objects
Traceback (most recent call last):
  File "/base/python_lib/versions/1/google/appengine/ext/webapp/
__init__.py", line 509, in __call__
    handler.post(*groups)
  File "/base/python_lib/versions/1/google/appengine/ext/webapp/
mail_handlers.py", line 58, in post
    self.receive(mail.InboundEmailMessage(self.request.body))
  File "/base/data/home/apps/brians-book/1.338965862895371758/
handle_email.py", line 33, in receive
    logging.info("Message body: " + text)
TypeError: cannot concatenate 'str' and 'generator' objects

-- 
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