E-mails com cabeçalhos ou anexos
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Existem algumas restrições nos cabeçalhos que podem ser usados e nos tipos de arquivos que podem ser anexados aos e-mails enviados pela API Mail.
Em um e-mail de saída, os cabeçalhos têm detalhes sobre remetente, destinatário, data e assunto da mensagem. Os cabeçalhos têm um nome e um valor.
Também é possível incluir os seguintes cabeçalhos em um e-mail de saída, no entanto, por motivos de segurança, outros cabeçalhos não são permitidos:
- In-Reply-To
- List-Id
- List-Unsubscribe
- On-Behalf-Of
- Referências
- Resent-Date
- Resent-From
- Resent-To
E-mails com anexos
Uma mensagem de e-mail de saída pode ter anexos de arquivos. Cada anexo tem um nome de arquivo e dados de arquivo. Os dados do arquivo podem ser de qualquer fonte, como um arquivo de dados do aplicativo ou o armazenamento de dados.
Extensões de nome de arquivo proibidas
Como medida de segurança para proteger contra vírus, os anexos de e-mail não podem ter as seguintes extensões de nome de arquivo e os arquivos ZIP não podem conter arquivos com as seguintes extensões de nome de arquivo:
- ade
- adp
- morcego
- 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
Anexos e tipos MIME (do inglês "Multipurpose Internet Mail Extensions")
O tipo MIME de um anexo é determinado a partir da extensão do arquivo. Ele é usado para identificar o tipo de conteúdo que está sendo enviado e determinar como esses dados são transferidos.
A seguir, veja uma lista de tipos MIME e as respectivas extensões de nome de arquivo correspondentes. Você não precisa usar apenas essas extensões. Caso a extensão seja desconhecida,
o App Engine atribuirá a ela o tipo MIME application/octet-stream
.
Tipo MIME |
Extensões de nome de arquivo |
application/msword |
doc, docx |
application/pdf |
pdf |
application/rss+xml |
rss |
application/vnd.google-earth.kml+xml |
kml |
application/vnd.google-earth.kmz |
kmz |
application/vnd.ms-excel |
xls, xlsx |
application/vnd.ms-powerpoint |
pps, ppt, pptx |
application/vnd.oasis.opendocument.presentation |
odp |
application/vnd.oasis.opendocument.spreadsheet |
ods |
application/vnd.oasis.opendocument.text |
odt |
application/vnd.sun.xml.calc |
sxc |
application/vnd.sun.xml.writer |
sxw |
application/x-gzip |
gzip |
application/zip |
zip |
audio/basic |
au snd |
audio/flac |
flac |
audio/mid |
mid, rmi |
audio/mp4 |
m4a |
audio/mpeg |
mp3 |
audio/ogg |
oga, ogg |
audio/x-aiff |
aif, aifc, aiff |
audio/x-wav |
wav |
image/gif |
gif |
image/jpeg |
jpeg, jpg, jpe |
image/png |
png |
image/tiff |
tiff, tif |
image/vnd.wap.wbmp |
wbmp |
image/x-ms-bmp |
bmp |
text/calendar |
ics |
text/comma-separated-values |
csv |
text/css |
css |
text/html |
htm, html |
text/plain |
asc, c, diff, log, patch, pot, text, txt |
text/x-vcard |
vcf |
video/mp4 |
mp4 |
video/mpeg |
mpeg, mpg, mpe |
video/ogg |
ogv |
video/quicktime |
qt, mov |
video/x-msvideo |
avi |
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-09-04 UTC.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[[["\u003cp\u003eThe Mail API for first-generation runtimes has specific restrictions on allowable headers and attachment types when sending emails, and it can be used while upgrading to corresponding second-generation runtimes.\u003c/p\u003e\n"],["\u003cp\u003eOnly a predefined list of email headers, including In-Reply-To, List-Id, and Resent-From, are allowed for use in outgoing emails for security reasons.\u003c/p\u003e\n"],["\u003cp\u003eFile attachments are permitted in outgoing emails, but certain file extensions, such as .exe, .bat, and .vbs, are strictly prohibited to protect against viruses, and this extends to files contained within ZIP archives.\u003c/p\u003e\n"],["\u003cp\u003eThe MIME type of a file attachment is determined by its file extension, and while you can use extensions not in the defined list, those will default to the \u003ccode\u003eapplication/octet-stream\u003c/code\u003e MIME type.\u003c/p\u003e\n"],["\u003cp\u003eA table is provided that lists the compatible Mime types and the file extensions that correspond to each of them, including image, video, audio, text, and other general application types.\u003c/p\u003e\n"]]],[],null,["# Mail with Headers or Attachments\n\nWhen you send mail using the [Mail API](/appengine/docs/legacy/standard/go111/mail),\nthere are some restrictions on the headers that you can use and the types of\nfiles you can attach.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| go\n| /services/access). If you are updating to the App Engine Go 1.12+ runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/go-differences) to learn about your migration options for legacy bundled services.\n\nOptional headers you can use\n----------------------------\n\nAn outgoing email has headers that provide details about the message, such as\nthe sender, recipient, date, and subject. Each header has a name and a value.\nYou can also include the following headers in an outgoing email; for security\npurposes, other headers are not allowed:\n\n- In-Reply-To\n- List-Id\n- List-Unsubscribe\n- On-Behalf-Of\n- References\n- Resent-Date\n- Resent-From\n- Resent-To\n\nMail with attachments\n---------------------\n\nAn outgoing email message can have file attachments. Each attachment has a\nfilename and file data. The file data can come from any source, such as an\napplication data file or the datastore.\n\n### Filename extensions that are prohibited\n\nAs a security measure to protect against viruses, email attachments cannot use\nthe following filename extensions, and ZIP files cannot contain files with the\nfollowing filename extensions:\n\n- ade\n- adp\n- bat\n- chm\n- cmd\n- com\n- cpl\n- exe\n- hta\n- ins\n- isp\n- jse\n- lib\n- mde\n- msc\n- msp\n- mst\n- pif\n- scr\n- sct\n- shb\n- sys\n- vb\n- vbe\n- vbs\n- vxd\n- wsc\n- wsf\n- wsh\n\n### Attachments and Multipurpose Internet Mail Extensions (MIME) types\n\nThe MIME type of an attachment is determined from the file's extension. The MIME\ntype identifies the type of content that is being sent, and can determine how\nthat data is transferred.\n\nThe following is a list of MIME types and their corresponding filename\nextensions. You are not limited to these extensions, but if you use an unknown\nextension, App Engine will assign it the MIME type `application/octet-stream`."]]