An email message can include file attachments. The attachments field of an email message accepts a list of either two-value tuples, or Attachment objects.

If tuples are used, one tuple must be created for each attachment. The first element of each tuple is the filename to use for the attachment in the message, and the second element is the data, as a byte string.

class AttachmentHandler(webapp2.RequestHandler):
    def post(self):
        f = self.request.POST['file']
                       to="Albert Johnson <>",
                       subject="The doc you requested",
Attached is the document file you requested.

The Team

As a security measure to protect against viruses, you cannot send email attachments—or zip files—containing any of the following extensions:

  • ade
  • adp
  • bat
  • chm
  • cmd
  • com
  • cpl
  • exe
  • hta
  • ins
  • isp
  • jse
  • lib
  • mde
  • msc
  • msp
  • mst
  • pif
  • scr
  • sct
  • shb
  • sys
  • vb
  • vbe
  • vbs
  • vxd
  • wsc
  • wsf
  • wsh

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

App Engine standard environment for Python