Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Lorsque vous envoyez un message à l'aide de l'API Mail, certaines restrictions s'appliquent aux en-têtes et aux types de fichiers que vous pouvez joindre.
En-têtes facultatifs
L'en-tête d'un e-mail sortant fournit des informations sur le message, tels que l'expéditeur, le destinataire, la date et l'objet. Chaque en-tête a un nom et une valeur.
Vous pouvez également inclure les en-têtes suivants dans un e-mail sortant. Pour des raisons de sécurité, les autres en-têtes ne sont pas autorisés :
In-Reply-To
List-Id
List-Unsubscribe
On-Behalf-Of
Références
Resent-Date
Resent-From
Resent-To
Messages avec pièces jointes
Un e-mail sortant peut contenir des pièces jointes. Chaque pièce jointe a un nom de fichier et des données de fichier. Ces dernières peuvent provenir de toutes sortes de sources, comme un fichier de données de l'application ou le datastore.
Extensions de nom de fichier interdites
Par mesure de sécurité contre les virus, les pièces jointes d'e-mail ne peuvent pas utiliser les extensions de nom de fichier suivantes, ni les contenir dans des fichiers ZIP :
ade
adp
chauve-souris
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
Pièces jointes et types MIME
Le type MIME d'une pièce jointe est défini à partir de l'extension du fichier. Il identifie le type de contenu en cours d'envoi et peut déterminer le mode de transfert de ces données.
Voici une liste des types MIME et de leurs extensions de nom de fichier correspondantes. Vous n'êtes pas limité à ces extensions, mais si vous utilisez une extension inconnue, App Engine lui attribuera le type MIME application/octet-stream.
Type MIME
Extensions de nom de fichier
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
texte/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
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/04/21 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/04/21 (UTC)."],[[["\u003cp\u003eThe Mail API allows sending emails with certain restrictions on allowed headers, including \u003ccode\u003eIn-Reply-To\u003c/code\u003e, \u003ccode\u003eList-Id\u003c/code\u003e, \u003ccode\u003eList-Unsubscribe\u003c/code\u003e, \u003ccode\u003eOn-Behalf-Of\u003c/code\u003e, \u003ccode\u003eReferences\u003c/code\u003e, \u003ccode\u003eResent-Date\u003c/code\u003e, \u003ccode\u003eResent-From\u003c/code\u003e, and \u003ccode\u003eResent-To\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eOutgoing emails can have file attachments, but certain filename extensions like \u003ccode\u003e.exe\u003c/code\u003e, \u003ccode\u003e.bat\u003c/code\u003e, and \u003ccode\u003e.vbs\u003c/code\u003e are prohibited for security reasons.\u003c/p\u003e\n"],["\u003cp\u003eThe MIME type of an attachment, which determines how the content is handled, is automatically inferred from the file extension, and if the extension is unknown, it will default to \u003ccode\u003eapplication/octet-stream\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA wide range of MIME types and their corresponding file extensions are supported, covering various document, audio, image, and video formats.\u003c/p\u003e\n"],["\u003cp\u003eThis API is supported for first generation runtimes, and information on upgrading to second generation runtimes is provided.\u003c/p\u003e\n"]]],[],null,["# Mail with headers or attachments\n\nGo Java PHP Python\n\nWhen you send mail using the [Mail API](/appengine/docs/standard/services/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|\n| /services/access). If you are updating to the App Engine runtime, refer to the [Upgrade to second-generation runtimes]() page to learn about your migration options for legacy bundled services.\n\nOptional headers\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`."]]