[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[[["\u003cp\u003eApp Engine applications can send and receive emails, using the Mail service to send messages and handling incoming messages via HTTP requests.\u003c/p\u003e\n"],["\u003cp\u003eSender addresses must be either the user's Gmail/Google Workspace account, a project-specific address (e.g., \u003ccode\u003eanything@[MY_PROJECT_ID].appspotmail.com\u003c/code\u003e), or listed in the Email API Authorized Senders.\u003c/p\u003e\n"],["\u003cp\u003eFor Google Workspace domains, setting the DNS SPF records is recommended to designate Google as a trusted email source, and DKIM authentication can be enabled to verify email authenticity.\u003c/p\u003e\n"],["\u003cp\u003eThe Mail service has daily quotas for API calls, messages sent, data, and attachments, and exceeding these limits results in an over quota exception; third-party mail providers are suggested for higher volume needs.\u003c/p\u003e\n"],["\u003cp\u003eThere are specific size limits for both outgoing and incoming mail messages, including attachments, and restrictions on the number of authorized senders, with each message counting toward the 'Mail API Calls' quota.\u003c/p\u003e\n"]]],[],null,["# Mail API for legacy bundled services\n\nGo Java PHP Python\n\nApp Engine applications can send email messages on behalf of the app's email\nreceiving addresses and on behalf of some users with Google Accounts. Apps can\nreceive email at various addresses. Apps send messages using the Mail service\nand receive messages in the form of HTTP requests initiated by\nApp Engine and posted to the app.\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\nSending mail\n------------\n\nThe Mail service can send email messages to one or more recipients. A message\ncontains a subject, a plaintext body, and an optional HTML body. It can also\ncontain file attachments and a limited set of headers.\n\nYou can use any email address for a recipient. A recipient can be in the\nmessage's \"to\" field, in the \"cc\" field, or hidden from the message recipients\n(a \"blind carbon copy\" or \"bcc\").\n\nWhen an application calls the Mail service to send a message, the message is\nqueued, and the call returns immediately. The Mail service uses standard\nprocedures for contacting each recipient's mail server, delivering the message,\nand retrying if the mail server cannot be contacted.\n\nWho can send mail\n-----------------\n\nFor security purposes, the sender address of a message must be one of the\nfollowing:\n\n- The Gmail or Google Workspace Account of the user who is currently signed in\n- Any email address of the form `anything@[MY_PROJECT_ID].appspotmail.com` or `anything@[MY_PROJECT_NUMBER].appspotmail.com`\n- Any email address listed in the Google Cloud console under [Email API Authorized Senders](https://console.cloud.google.com/appengine/settings)\n\nAll email addresses on the\n[Email API Authorized Senders](https://console.cloud.google.com/appengine/settings) list need to\nbe valid Gmail or Google-hosted domain accounts. App Administrators can add the\nfollowing accounts to the list of Authorized Senders:\n\n- Their own email address\n- Any group for which they are an Owner or Manager\n- Applications hosted in a Google Workspace domain: `noreply@[DOMAIN].com`, as long as `noreply@[DOMAIN].com` is a valid account (user or group).\n\nIn addition, domain administrators of domains managed by Google Workspace can\nadd any user in their domain to the list of authorized senders.\n\nYou are limited to a maximum of 50 authorized senders.\n\nMail from Google Workspace\n--------------------------\n\nIf you will be sending email from a domain managed by Google Workspace, you\nshould set the DNS `SPF` records for your domain to indicate that Google is a\ntrusted source for your email. For instructions on how to do this, see [SPF\nrecords](http://www.google.com/support/a/bin/answer.py?answer=33786)\nin the Google Workspace Help Center.\n\nNote that if you use aliases set up for your Google Workspace domain, you cannot\nsend email from email addresses that use the domain alias.\n\nBounce notifications when mail is not delivered\n-----------------------------------------------\n\nMail that matches a known signature for spam, viruses, or other malicious\ncontent may not be accepted for delivery.\n\nIf the Mail service cannot deliver a message, or if a recipient's mail server\nreturns a bounce message (for example, because there is no account for that\naddress on that system), an error message can be sent by email to the address of\nthe sender for the message. The application itself does not receive any\nnotification about whether delivery succeeded or failed.\n\nBy default, email bounce notifications are not enabled. In order to receive\nemail bounce notifications, you need to configure your application.\n\nMail and the development server\n-------------------------------\n\nAuthentication with DomainKeys Identified Mail (DKIM)\n-----------------------------------------------------\n\nWhen you send mail, App Engine uses the DomainKeys Identified Mail\n(DKIM) standard to authenticate the domain. If your application sends messages\nfrom an email address that is part of a Google Workspace domain,\nApp Engine can\ncryptographically sign the emails it sends. This signature says that an email\nthat purports to be from `emma@example.com` really came from `example.com`. The\nrecipient can check this signature; if the signature is correct, the recipient\nknows that the sender's domain wasn't spoofed.\n\nTo enable DKIM authentication for messages sent from Google Workspace email\naddresses, follow\n[these instructions](http://support.google.com/a/bin/answer.py?answer=174124)\nin the Google Workspace Help Center. Note that it can take up to 48 hours before\nDKIM authentication is active for your Google Workspace domain.\n\nYou must also ensure that your application is [using a custom\ndomain](/appengine/docs/standard/mapping-custom-domains)\nand is the same as your Google Workspace domain. Also note that Google Workspace\ndomains with subdomains such as `subdomain.example.com` are not permitted.\n\nApp Engine will sign the application's outgoing mails if the sender\naddress is part of a Google Workspace domain with DKIM enabled. Additionally,\nthe sender address must be formatted such that the domain part of the email\naddress only consists of lowercase letters.\n\nQuotas and limits\n-----------------\n\nTo see the current quota usage of your application, go to the Quota Details page\nin the Google Cloud console.\n\n[Go to the Quota Details page](https://console.cloud.google.com/appengine/quotadetails)\n\nEach Mail service request counts toward the **Mail API Calls** quota. There are\nalso quotas for the number of messages you can send, the number of Admin\nmessages you can send, and the amount of data and attachments you can send. For\nmore details, see [Mail quotas](/appengine/docs/standard/quotas#Mail).\n| **Note:** Data sent in the body of an email message or as an attachment also counts towards the **Outgoing Bandwidth (billable) quota**.\n\nThe quota is reset daily. If you exceed the daily quota, you will get an [over\nquota exception](/appengine/docs/quotas#When_a_Resource_is_Depleted). If you\nneed to send more mail than the quota allows, you can use a third-party mail\nprovider, such as\n[SendGrid](https://sendgrid.com/) or\n[Mailgun](https://www.mailgun.com/).\n\nIn addition to quotas, the following limits apply to the Mail service:\n\nWhat's next\n-----------\n\n- Read the [bulk mail guidelines](/appengine/docs/standard/services/mail/bulk-mail).\n- Learn how to use the Mail API to [send mail](/appengine/docs/standard/services/mail/sending-mail-with-mail-api) and [receive mail](/appengine/docs/standard/services/mail/receiving-mail-with-mail-api).\n- Refer to the ."]]