Mail with Headers or Attachments

When you send mail using the Mail API, there are some restrictions on the headers that you can use and the types of files you can attach.

Optional headers you can use

An outgoing email has headers that provide details about the message, such as the sender, recipient, date, and subject. Each header has a name and a value. You can also include the following headers in an outgoing email; for security purposes, other headers are not allowed:

  • In-Reply-To
  • List-Id
  • List-Unsubscribe
  • On-Behalf-Of
  • References
  • Resent-Date
  • Resent-From
  • Resent-To

Mail with attachments

An outgoing email message can have file attachments. Each attachment has a filename and file data. The file data can come from any source, such as an application data file or the datastore.

Filename extensions that are prohibited

As a security measure to protect against viruses, email attachments cannot use the following filename extensions, and ZIP files cannot contain files with the following filename 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

Attachments and Multipurpose Internet Mail Extensions (MIME) types

The MIME type of an attachment is determined from the file's extension. The MIME type identifies the type of content that is being sent, and can determine how that data is transferred.

The following is a list of MIME types and their corresponding filename extensions. You are not limited to these extensions, but if you use an unknown extension, App Engine will assign it the MIME type application/octet-stream.

MIME typeFilename extensions
application/msworddoc, docx
application/pdfpdf
application/rss+xmlrss
application/vnd.google-earth.kml+xmlkml
application/vnd.google-earth.kmzkmz
application/vnd.ms-excelxls, xlsx
application/vnd.ms-powerpointpps, ppt, pptx
application/vnd.oasis.opendocument.presentationodp
application/vnd.oasis.opendocument.spreadsheetods
application/vnd.oasis.opendocument.textodt
application/vnd.sun.xml.calcsxc
application/vnd.sun.xml.writersxw
application/x-gzipgzip
application/zipzip
audio/basicau snd
audio/flacflac
audio/midmid, rmi
audio/mp4m4a
audio/mpegmp3
audio/oggoga, ogg
audio/x-aiffaif, aifc, aiff
audio/x-wavwav
image/gifgif
image/jpegjpeg, jpg, jpe
image/pngpng
image/tifftiff, tif
image/vnd.wap.wbmpwbmp
image/x-ms-bmpbmp
text/calendarics
text/comma-separated-valuescsv
text/csscss
text/htmlhtm, html
text/plainasc, c, diff, log, , pot, text, txt
text/x-vcardvcf
video/mp4mp4
video/mpegmpeg, mpg, mpe
video/oggogv
video/quicktimeqt, mov
video/x-msvideoavi