Python 2.7 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Python.
Bulk Mail Guidelines
Stay organized with collections
Save and categorize content based on your preferences.
You must follow these guidelines if your application is sending
out bulk email, that is, similar messages to numerous recipients. These
guidelines will help to improve your inbox delivery rate to Gmail users, by
ensuring that all recipients in your distribution list actually want to receive
the email. If recipients manually mark your email as spam, then that acts as a
strong signal to Gmail to mark future emails from you as spam.
For more information on sending mail, see the
Mail API Overview.
Authentication and identification
- Use the same sender for every bulk email. When calling the Mail API function
to send email, the
From
header will be set to match the sender you specify.
- Your sender address should be an account in a
Google Workspace
domain. If the domain is still in the free trial period or has less than six
users, Google accounts that send too many emails marked as spam might be
temporarily disabled. In these cases, the Mail API will throw an exception
with an
Unauthorized sender
error message.
- Sign your email with DKIM, which
requires a G Suite domain if you are sending using App Engine.
- Publish an SPF record
to prevent spammers from spoofing your envelope sender address. SPF verifies
that email is sent from an IP address that is published in the DNS records of
the envelope sender. App Engine's envelope sender is in the
apphosting.bounces.google.com
domain, so your SPF record may not be used to
determine if email from App Engine should be delivered.
Subscription
Each user in your distribution list should opt-in to receive messages from you
in one of the following ways:
- By sending you an email asking to subscribe
- By manually checking a box on a web form or within a piece of software
Using an email address list purchased from a third party is not considered
opt-in. You also should not set a checkbox on a web form or within a piece of
software to subscribe all users by default. Users should not be required to
explicitly opt out of mailings.
You should verify that the person that signed up by checking the box on the
web form or in software is actually receiving emails at the address that was
specified in the form. Verify the user by sending an email that requires them
to confirm receipt.
Unsubscribing
- A user must be able to unsubscribe in one of the following ways:
- Through a prominent link in the email with no further user interaction
other than confirmation.
- Via an email unsubscribe response.
- App Engine can only receive email sent to the
[APP_ID].appspotmail.com
domain. Therefore, you will need to set your sender to an address in this
domain if you want to automatically handle email unsubscribe responses within
App Engine.
- Use the
List-Unsubscribe
header, which is supported by the App Engine Mail
API.
- Automatically unsubscribe users whose
addresses bounce multiple pieces of email. You can configure your app to
receive bounce notifications.
- Periodically send email confirmations to users, offering the opportunity to
unsubscribe from each list they are signed up for.
- Explicitly indicate the email address subscribed within your email, because
users might forward email from other accounts.
- Format to RFC 2822 SMTP standards
and, if using HTML, w3.org standards.
- Attempts to hide the true sender of the message or the true landing page for
any web links in the message may result in non-delivery. For example, we
recommend that you do not use URL shortener services in bulk email, because
these can mask the real URLs contained in the body of your email.
- The subject of each message should be relevant to the body's content and
should not be misleading.
Delivery
- The following factors will help messages arrive in Gmail users' inboxes:
- The
From
address is listed in the user's Contacts list.
- A user clicks "Not Spam" to alert Gmail that messages sent from that
address are solicited.
- If you send both promotional email and transactional email relating to your
organization, we recommend separating email by purpose as much as possible.
You can do this by:
- Using separate email addresses for each function.
- Sending email from different domains for each function.
Third-party senders
- If others use your service to send email, you are responsible for monitoring
your users and/or clients' behavior. You must remove, in a timely fashion,
all users and/or clients who use your service to send spam email. The Google
Cloud Platform Acceptable Use Policy specifically prohibits spam.
Your application can be suspended if you violate this policy, as described in
the Google Cloud Platform Terms of Service.
- You must have an email address available for users and/or clients to report
abuse, which should normally be
abuse@[YOUR_DOMAIN].com
. You should also
monitor postmaster@[YOUR_DOMAIN].com
.
- Monitor email sent to app admins. Google may need to urgently contact app
admins, for example to notify you of a violation of the Acceptable Use Policy.
We can help you to resolve the problems more quickly if you respond promptly
to our emails.
- You must maintain up-to-date contact information in your WHOIS record
maintained by your domain registrar, and on
abuse.net.
Affiliate marketing programs
- Affiliate marketing programs reward third-parties for bringing visitors to
your site. These programs are attractive to spammers and can potentially do
more harm than good. Please note the following:
- If your brand becomes associated with affiliate marketing spam, it can
affect the email sent by you and your other affiliates.
- It is your responsibility to monitor your affiliates and remove them if
they send spam.
Alternatives to the App Engine Mail API
- You can use a third-party email delivery service provider to send email from
App Engine. These services may provide additional features that are not
available in the Mail API and may be a better solution for some bulk email
senders.
- You can use the Sockets API to connect directly to an SMTP
server to send email.
Limits for bulk mail
If you send too many emails in a short burst, some emails might be silently
dropped due to Google safety limits. To avoid this, calculate the maximum daily
rate of emails sent per second by dividing your daily quota by 86,400, the
number of seconds in a day. Do not send bulk email at a rate higher than 50
times the maximum daily rate.
For more information on other quotas around sending mail, see
Quotas and limits.
What's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003eThese guidelines are essential for improving email delivery rates to Gmail users when sending bulk emails, emphasizing the importance of recipients' consent and avoiding spam practices.\u003c/p\u003e\n"],["\u003cp\u003eUsing the same sender for bulk emails, ensuring it's a Google Workspace account, signing emails with DKIM, and publishing an SPF record are crucial for authentication and preventing spam spoofing.\u003c/p\u003e\n"],["\u003cp\u003eUsers must actively opt-in to receive emails, either by requesting subscription or manually checking a box, and the practice of purchasing email lists or pre-selecting opt-in boxes is strongly discouraged.\u003c/p\u003e\n"],["\u003cp\u003eClear and easy unsubscription methods must be provided, including a prominent unsubscribe link, email response handling, and the use of the \u003ccode\u003eList-Unsubscribe\u003c/code\u003e header.\u003c/p\u003e\n"],["\u003cp\u003eMaintaining proper email formatting according to RFC 2822 SMTP and w3.org standards, avoiding URL shorteners, and providing relevant subject lines are necessary to ensure email deliverability.\u003c/p\u003e\n"]]],[],null,["# Bulk Mail Guidelines\n\nYou must follow these guidelines if your application is sending\nout bulk email, that is, similar messages to numerous recipients. These\nguidelines will help to improve your inbox delivery rate to Gmail users, by\nensuring that all recipients in your distribution list actually want to receive\nthe email. If recipients manually mark your email as spam, then that acts as a\nstrong signal to Gmail to mark future emails from you as spam.\n\nFor more information on sending mail, see the\n[Mail API Overview](/appengine/docs/legacy/standard/python/mail).\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| python3\n|\n| /services/access). If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\nAuthentication and identification\n---------------------------------\n\n- Use the same sender for every bulk email. When calling the Mail API function to send email, the `From` header will be set to match the sender you specify.\n- Your sender address should be an account in a [Google Workspace](https://workspace.google.com/) domain. If the domain is still in the free trial period or has less than six users, Google accounts that send too many emails marked as spam might be temporarily disabled. In these cases, the Mail API will throw an exception with an `Unauthorized sender` error message.\n- Sign your email with [DKIM](https://support.google.com/a/answer/174124), which requires a G Suite domain if you are sending using App Engine.\n- Publish an [SPF record](http://support.google.com/a/bin/answer.py?answer=33786) to prevent spammers from spoofing your envelope sender address. SPF verifies that email is sent from an IP address that is published in the DNS records of the envelope sender. App Engine's envelope sender is in the `apphosting.bounces.google.com` domain, so your SPF record may not be used to determine if email from App Engine should be delivered.\n\nSubscription\n------------\n\n- Each user in your distribution list should opt-in to receive messages from you\n in one of the following ways:\n\n - By sending you an email asking to subscribe\n - By manually checking a box on a web form or within a piece of software\n- Using an email address list purchased from a third party is not considered\n opt-in. You also should not set a checkbox on a web form or within a piece of\n software to subscribe all users by default. Users should not be required to\n explicitly opt out of mailings.\n\n- You should verify that the person that signed up by checking the box on the\n web form or in software is actually receiving emails at the address that was\n specified in the form. Verify the user by sending an email that requires them\n to confirm receipt.\n\nUnsubscribing\n-------------\n\n- A user must be able to unsubscribe in one of the following ways:\n - Through a prominent link in the email with no further user interaction other than confirmation.\n - Via an email unsubscribe response.\n- App Engine can only receive email sent to the `[APP_ID].appspotmail.com` domain. Therefore, you will need to set your sender to an address in this domain if you want to automatically handle email unsubscribe responses within App Engine.\n- Use the `List-Unsubscribe` header, which is [supported by the App Engine Mail\n API](#Sending_mail_with_headers).\n- Automatically unsubscribe users whose addresses bounce multiple pieces of email. You can [configure your app to\n receive bounce notifications](#Receiving_bounce_notification).\n- Periodically send email confirmations to users, offering the opportunity to unsubscribe from each list they are signed up for.\n- Explicitly indicate the email address subscribed within your email, because users might forward email from other accounts.\n\nFormat\n------\n\n- Format to [RFC 2822 SMTP standards](http://www.ietf.org/rfc/rfc2822.txt) and, if using HTML, [w3.org standards](http://www.w3.org/standards/techs/html).\n- Attempts to hide the true sender of the message or the true landing page for any web links in the message may result in non-delivery. For example, we recommend that you do not use URL shortener services in bulk email, because these can mask the real URLs contained in the body of your email.\n- The subject of each message should be relevant to the body's content and should not be misleading.\n\nDelivery\n--------\n\n- The following factors will help messages arrive in Gmail users' inboxes:\n - The `From` address is listed in the user's Contacts list.\n - A user clicks \"Not Spam\" to alert Gmail that messages sent from that address are solicited.\n- If you send both promotional email and transactional email relating to your organization, we recommend separating email by purpose as much as possible. You can do this by:\n - Using separate email addresses for each function.\n - Sending email from different domains for each function.\n\nThird-party senders\n-------------------\n\n- If others use your service to send email, you are responsible for monitoring your users and/or clients' behavior. You must remove, in a timely fashion, all users and/or clients who use your service to send spam email. The [Google\n Cloud Platform Acceptable Use Policy](/terms/aup) specifically prohibits spam. Your application can be suspended if you violate this policy, as described in the [Google Cloud Platform Terms of Service](/terms).\n- You must have an email address available for users and/or clients to report abuse, which should normally be `abuse@[YOUR_DOMAIN].com`. You should also monitor `postmaster@[YOUR_DOMAIN].com`.\n- Monitor email sent to app admins. Google may need to urgently contact app admins, for example to notify you of a violation of the Acceptable Use Policy. We can help you to resolve the problems more quickly if you respond promptly to our emails.\n- You must maintain up-to-date contact information in your WHOIS record maintained by your domain registrar, and on [abuse.net](http://abuse.net/).\n\nAffiliate marketing programs\n----------------------------\n\n- Affiliate marketing programs reward third-parties for bringing visitors to your site. These programs are attractive to spammers and can potentially do more harm than good. Please note the following:\n - If your brand becomes associated with affiliate marketing spam, it can affect the email sent by you and your other affiliates.\n - It is your responsibility to monitor your affiliates and remove them if they send spam.\n\nAlternatives to the App Engine Mail API\n---------------------------------------\n\n- You can use a third-party email delivery service provider to send email from App Engine. These services may provide additional features that are not available in the Mail API and may be a better solution for some bulk email senders.\n- You can use the [Sockets API](../sockets) to connect directly to an SMTP server to send email.\n\nLimits for bulk mail\n--------------------\n\nIf you send too many emails in a short burst, some emails might be silently\ndropped due to Google safety limits. To avoid this, calculate the maximum daily\nrate of emails sent per second by dividing your daily quota by 86,400, the\nnumber of seconds in a day. Do not send bulk email at a rate higher than 50\ntimes the maximum daily rate.\n\nFor more information on other quotas around sending mail, see\n[Quotas and limits](/appengine/docs/legacy/standard/python/mail#quotas_and_limits).\n\nWhat's next\n-----------\n\n- Read the [Mail API\n Overview](/appengine/docs/legacy/standard/python/mail).\n- Learn how to [send\n mail with the Mail API](/appengine/docs/legacy/standard/python/mail/sending-mail-with-mail-api)."]]