Exemple #1
0
 def receive(self, mail_message):
     logging.info("Received a message from: " + mail_message.sender)
     html_bodies = mail_message.bodies()
     
     email_message_body = ''
     for content_type, body in html_bodies:
         decoded_html = body.decode()
         email_message_body = decoded_html + email_message_body
         logging.info("body message: " + decoded_html)
    
     new_steve_email = EmailMessage()
     new_steve_email.populate(sender = mail_message.sender,
                              subject = mail_message.subject,
                              owner = 'steve',
                              message_body = email_message_body)
     new_steve_email.put()    
     
     forward_email_to_owner(STEVE_EMAIL, email_message_body)
Exemple #2
0
 def receive(self, mail_message):
     logging.info("Received a message from: " + mail_message.sender)
     html_bodies = mail_message.bodies()
     
     email_message_body = ''
     for content_type, body in html_bodies:
         decoded_html = body.decode()
         email_message_body = decoded_html + email_message_body
         logging.info("body message: " + decoded_html)
    
     new_support_email = EmailMessage(parent=email_key('Email'))
     new_support_email.populate(sender = mail_message.sender,
                              subject = mail_message.subject,
                              owner = 'support',
                              message_body = email_message_body)
     new_support_email.put()    
     
     forward_email_to_owner(BRIAN_EMAIL, email_message_body)
     forward_email_to_owner(ANDREW_EMAIL, email_message_body)
     logging.info("Fowarding email to Brian and Andrew")
 def get(self):
     email_query = EmailMessage.query(
         ancestor=email_key('Email')).order(-EmailMessage.date)
     emails = email_query.fetch(5) 
     template_values = {
         'name': CURRENT_USER_NAME,
         'emails': emails
     }
     
     template = JINJA_ENVIRONMENT.get_template('html/viewemail.html')                   
     self.response.write(template.render(template_values))