|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -# [START log_sender_handler] |
| 15 | +# [START gae_mail_log_sender_handler] |
16 | 16 | import logging |
17 | 17 |
|
18 | 18 | from google.appengine.ext.webapp.mail_handlers import InboundMailHandler |
|
22 | 22 | class LogSenderHandler(InboundMailHandler): |
23 | 23 | def receive(self, mail_message): |
24 | 24 | logging.info("Received a message from: " + mail_message.sender) |
25 | | - # [END log_sender_handler] |
26 | | - # [START bodies] |
| 25 | + # [END gae_mail_log_sender_handler] |
| 26 | + # [START gae_mail_log_sender_handler_bodies] |
27 | 27 | plaintext_bodies = mail_message.bodies("text/plain") |
28 | 28 | html_bodies = mail_message.bodies("text/html") |
29 | 29 |
|
30 | 30 | for content_type, body in html_bodies: |
31 | 31 | decoded_html = body.decode() |
32 | | - # ... |
33 | | - # [END bodies] |
34 | 32 | logging.info("Html body of length %d.", len(decoded_html)) |
35 | 33 | for content_type, body in plaintext_bodies: |
36 | 34 | plaintext = body.decode() |
37 | 35 | logging.info("Plain text body of length %d.", len(plaintext)) |
| 36 | + # ... |
| 37 | + # [END gae_mail_log_sender_handler_bodies] |
38 | 38 |
|
39 | 39 |
|
40 | | -# [START app] |
| 40 | +# [START gae_mail_log_sender_handler_app] |
41 | 41 | app = webapp2.WSGIApplication([LogSenderHandler.mapping()], debug=True) |
42 | | -# [END app] |
| 42 | +# [END gae_mail_log_sender_handler_app] |
0 commit comments