Python 2.7 telah mencapai akhir dukungan
dan akan dihentikan penggunaannya
pada 31 Januari 2026. Setelah penghentian penggunaan, Anda tidak akan dapat men-deploy aplikasi Python 2.7, meskipun organisasi Anda sebelumnya menggunakan kebijakan organisasi untuk mengaktifkan kembali deployment runtime lama. Aplikasi Python 2.7 yang ada akan terus berjalan dan menerima traffic setelah
tanggal penghentiannya. Sebaiknya Anda bermigrasi ke versi Python terbaru yang didukung.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Untuk menerima notifikasi email tidak terkirim, Anda harus mengonfigurasi
aplikasi untuk mengaktifkan notifikasi email dan harus membuat pengendali
untuk menangani notifikasi tersebut.
Mengonfigurasi Aplikasi Anda untuk Menerima Notifikasi Tidak Terkirim
Ada dua bagian untuk konfigurasi. Pertama, Anda harus mengaktifkan
notifikasi. Kedua, Anda perlu menetapkan pemetaan antara /_ah/bounce dan pengendali pantulan, sehingga App Engine tahu tempat untuk memposting data notifikasi. Untuk mengonfigurasi aplikasi Anda agar menerima notifikasi email tidak terkirim:
Tambahkan kode berikut ke file app.yaml Anda untuk mengaktifkan notifikasi:
inbound_services:-mail_bounce
Selain itu, di app.yaml, deklarasikan pemetaan antara
/_ah/bounce dan pengendali notifikasi tidak terkirim dalam kode Anda, misalnya:
Notifikasi tidak terkirim adalah pesan otomatis dari sistem email yang menyatakan bahwa terjadi masalah dengan pengiriman pesan. Di aplikasi, Anda harus membuat kode pengendali pantulan untuk menerima dan memproses notifikasi ini.
Salah satu cara untuk menulis pengendali pantulan adalah menggunakan class praktis BounceNotificationHandler. Jika melalui rute ini, Anda harus mengganti metode
receive(), yang dipanggil dengan
argumen class
BounceNotification. Baik menggunakan class praktis BounceNotificationHandler maupun tidak, Anda harus menggunakan BounceNotification untuk mengurai notifikasi tidak terkirim.
BounceNotificationHandler dan BounceNotification
ada dalam paket google.appengine.ext.webapp.mail_handlers.
Berikut adalah contoh pengendali pantulan yang menggunakan class praktis BounceNotificationHandler:
classLogBounceHandler(BounceNotificationHandler):defreceive(self,bounce_message):logging.info('Received bounce post ... [%s]',self.request)logging.info('Bounce original: %s',bounce_message.original)logging.info('Bounce notification: %s',bounce_message.notification)
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eThis content describes how to configure an app to receive email bounce notifications using legacy bundled services and APIs in the first-generation App Engine standard environment.\u003c/p\u003e\n"],["\u003cp\u003eTo receive bounce notifications, you must enable the \u003ccode\u003email_bounce\u003c/code\u003e inbound service in your \u003ccode\u003eapp.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eYou must also define a mapping in your \u003ccode\u003eapp.yaml\u003c/code\u003e file between the \u003ccode\u003e/_ah/bounce\u003c/code\u003e URL and your bounce notification handler.\u003c/p\u003e\n"],["\u003cp\u003eA bounce handler is needed to process the bounce notifications, which can be done using the \u003ccode\u003eBounceNotificationHandler\u003c/code\u003e or directly with the \u003ccode\u003eBounceNotification\u003c/code\u003e class.\u003c/p\u003e\n"],["\u003cp\u003eBoth the \u003ccode\u003eBounceNotificationHandler\u003c/code\u003e and \u003ccode\u003eBounceNotification\u003c/code\u003e classes are located within the \u003ccode\u003egoogle.appengine.ext.webapp.mail_handlers\u003c/code\u003e package.\u003c/p\u003e\n"]]],[],null,["# Receiving Bounce Notification\n\nIn order to receive email bounce notifications, you need to configure\nyour app to enable email notification and you need to create a handler\nto handle those notifications.\n| This page describes how to use the legacy bundled services and APIs. This API can only run in first-generation runtimes in the App Engine standard environment. 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\nConfiguring Your App to Receive Bounce\nNotifications\n----------------------------------------------------\n\nThere are two parts to the configuration. First, you need to enable\nnotification. Second, you need to set the mapping between\n`/_ah/bounce` and your bounce handler, so App Engine knows where to\nPOST the notification data. To configure your app to receive bounced email\nnotifications:\n\n1. Add the following to your `app.yaml` file to enable notification: \n\n ```python\n inbound_services:\n - mail_bounce\n ```\n2. Also in `app.yaml`, declare a mapping between `/_ah/bounce` and the bounce notification handler in your code, for example: \n\n - url: /_ah/bounce\n script: handle_bounced_email.app\n login: admin\n\nHandling Bounce Notifications\n-----------------------------\n\nA [bounce notification](http://en.wikipedia.org/wiki/Bounce_message) is an\nautomated message from an email system that there's been a problem with message\ndelivery. In your app, you'll need to create bounce handler code to receive and\nprocess these notifications.\n\nOne way to write a bounce handler is to use the\n[BounceNotificationHandler](/appengine/docs/legacy/standard/python/refdocs/google.appengine.ext.webapp.mail_handlers#google.appengine.ext.webapp.mail_handlers.BounceNotificationHandler)\nconvenience class. If you go this route, you'll need to override its\n`receive()` method, which is called with an\nargument of the\n[BounceNotification](/appengine/docs/legacy/standard/python/refdocs/google.appengine.ext.webapp.mail_handlers#google.appengine.ext.webapp.mail_handlers.BounceNotification)\nclass. Whether you use the `BounceNotificationHandler` convenience class\nor not, you do need to use `BounceNotification` to parse the bounce\nnotifications.\n\nBoth `BounceNotificationHandler` and `BounceNotification`\nare in the `google.appengine.ext.webapp.mail_handlers` package.\n\nHere is a sample bounce handler that uses the\n`BounceNotificationHandler` convenience class: \n\n class LogBounceHandler(BounceNotificationHandler):\n def receive(self, bounce_message):\n logging.info('Received bounce post ... [%s]', self.request)\n logging.info('Bounce original: %s', bounce_message.original)\n logging.info('Bounce notification: %s', bounce_message.notification)"]]