[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-04。"],[[["\u003cp\u003eApp Engine applications can send and receive email messages using the Mail service, with messages sent via the Mail service being queued and delivered using standard procedures.\u003c/p\u003e\n"],["\u003cp\u003eFor security, the sender's email address must be either the currently signed-in user's Gmail or Google Workspace account, an address in the format \u003ccode\u003eanything@[MY_PROJECT_ID].appspotmail.com\u003c/code\u003e or \u003ccode\u003eanything@[MY_PROJECT_NUMBER].appspotmail.com\u003c/code\u003e, or be on the Email API Authorized Senders list.\u003c/p\u003e\n"],["\u003cp\u003eIf an email cannot be delivered, the sender may receive a bounce notification, but this feature is not enabled by default and requires configuration.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine uses DomainKeys Identified Mail (DKIM) to authenticate outgoing emails from Google Workspace domains, cryptographically signing emails to prevent domain spoofing.\u003c/p\u003e\n"],["\u003cp\u003eThe Mail service has quotas for API calls, message counts, data volume, and attachment size, and if needed, users can use third-party mail providers like SendGrid for increased sending capacity.\u003c/p\u003e\n"]]],[],null,["# Mail API for legacy bundled services\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| php-gen2\n|\n| /services/access). If you are updating to the App Engine PHP 7/8 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/php-differences) 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\nWhen an application running in the development server calls the Mail service to\nsend an email message, the message is printed to the application logs. The\ndevelopment server does not send the email message.\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/legacy/standard/php/console/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/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](/appengine/docs/legacy/standard/php/mail/sending-messages)\n.\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/legacy/standard/php/mail/bulk-mail).\n- Learn how to [send and receive mail with the Mail API](/appengine/docs/legacy/standard/php/mail/sending-receiving-with-mail-api)."]]