Java 8 ha raggiunto la fine del supporto
e verrà
ritirato
il 31 gennaio 2026. Dopo il ritiro, non potrai eseguire il deployment di applicazioni Java 8, anche se la tua organizzazione ha utilizzato in precedenza un criterio dell'organizzazione per riattivare i deployment di runtime legacy. Le tue applicazioni Java 8 esistenti continueranno a essere eseguite e a ricevere traffico dopo la
data di ritiro. Ti consigliamo di
eseguire la migrazione all'ultima versione supportata di Java.
Ricezione di notifiche di mancato recapito
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Per ricevere le notifiche di mancato recapito delle email, devi configurare la tua app per
attivare la notifica di mancato recapito e devi gestire la notifica in arrivo nella
tua app.
Configurazione dell'applicazione per la notifica di mancato recapito delle email
Per impostazione predefinita, le applicazioni non ricevono notifiche di mancato recapito per le email che
non è stato possibile recapitare. Per abilitare il servizio di notifica dei mancati recapiti in entrata, devi modificare i file di configurazione appengine-web.xml
e web.xml
dell'applicazione.
Modifica appengine-web.xml
aggiungendo una sezione inbound-services
per attivare il
servizio di rimbalzo in entrata:
Modifica web.xml
mappando l'URL di rimbalzo /_ah/bounce
al servlet di gestione
dei rimbalzi, come segue:
Gestire le notifiche di mancato recapito
L'API JavaMail include la
classe BounceNotificationParser,
che utilizzi per analizzare le notifiche di mancato recapito in entrata, come mostrato qui:
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-09-04 UTC.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eTo enable email bounce notifications, you must configure your application to receive them and handle them within your app.\u003c/p\u003e\n"],["\u003cp\u003eEnable the incoming bounce notification service by adding the \u003ccode\u003email_bounce\u003c/code\u003e service within the \u003ccode\u003einbound-services\u003c/code\u003e section of your \u003ccode\u003eappengine-web.xml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eMap the bounce URL \u003ccode\u003e/_ah/bounce\u003c/code\u003e to your bounce handling servlet within your \u003ccode\u003eweb.xml\u003c/code\u003e file to direct bounce notifications appropriately.\u003c/p\u003e\n"],["\u003cp\u003eUse the \u003ccode\u003eBounceNotificationParser\u003c/code\u003e class from the JavaMail API to parse incoming bounce notifications in your application.\u003c/p\u003e\n"]]],[],null,["# Receiving Bounce Notification\n\nTo receive email bounce notifications, you need to configure your app to\nenable bounce notification and you need to handle the incoming notification in\nyour app.\n\n\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| java-gen2\n|\n| /services/access). If you are updating to the App Engine Java 11/17 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/java-differences) to learn about your migration options for legacy bundled services.\n\n\u003cbr /\u003e\n\nConfiguring your application for email bounce notification\n----------------------------------------------------------\n\nBy default, applications do not receive bounce notifications for email that\ncould not be delivered. To enable the incoming bounce notification service, you\nmust modify your application `appengine-web.xml` and `web.xml` configuration\nfiles.\n\nModify `appengine-web.xml`by adding an `inbound-services` section to enable the\nincoming bounce service: \n\n \u003cinbound-services\u003e\n \u003c!-- Used to handle incoming mail. --\u003e\n \u003cservice\u003email\u003c/service\u003e\n \u003c!-- Used to handle bounced mail notifications. --\u003e\n \u003cservice\u003email_bounce\u003c/service\u003e\n \u003c/inbound-services\u003e\n\nModify `web.xml` by mapping the bounce URL `/_ah/bounce` to your bounce\nhandling servlet, as follows: \n\n \u003cservlet\u003e\n \u003cservlet-name\u003ebouncehandler\u003c/servlet-name\u003e\n \u003cservlet-class\u003ecom.example.appengine.mail.BounceHandlerServlet\u003c/servlet-class\u003e\n \u003c/servlet\u003e\n \u003cservlet-mapping\u003e\n \u003cservlet-name\u003ebouncehandler\u003c/servlet-name\u003e\n \u003curl-pattern\u003e/_ah/bounce\u003c/url-pattern\u003e\n \u003c/servlet-mapping\u003e\n \u003csecurity-constraint\u003e\n \u003cweb-resource-collection\u003e\n \u003cweb-resource-name\u003ebounce\u003c/web-resource-name\u003e\n \u003curl-pattern\u003e/_ah/bounce\u003c/url-pattern\u003e\n \u003c/web-resource-collection\u003e\n \u003cauth-constraint\u003e\n \u003crole-name\u003eadmin\u003c/role-name\u003e\n \u003c/auth-constraint\u003e\n \u003c/security-constraint\u003e\n\nHandling Bounce Notifications\n-----------------------------\n\nThe JavaMail API includes the\n[BounceNotificationParser class](/appengine/docs/legacy/standard/java/javadoc/com/google/appengine/api/mail/BounceNotificationParser),\nwhich you use to parse incoming bounce notifications, as shown here: \n\n import com.google.appengine.api.mail.https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.mail.BounceNotification.html;\n import com.google.appengine.api.mail.https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.mail.ee10.BounceNotificationParser.html;\n\n import java.io.IOException;\n import java.util.logging.Logger;\n import javax.mail.MessagingException;\n import javax.servlet.http.HttpServlet;\n import javax.servlet.http.HttpServletRequest;\n import javax.servlet.http.HttpServletResponse;\n\n public class BounceHandlerServlet extends HttpServlet {\n\n private static final Logger log = Logger.getLogger(BounceHandlerServlet.class.getName());\n\n @Override\n public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {\n try {\n https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.mail.BounceNotification.html bounce = https://cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.mail.ee10.BounceNotificationParser.html.parse(req);\n log.warning(\"Bounced email notification.\");\n // The following data is available in a BounceNotification object\n // bounce.getOriginal().getFrom() \n // bounce.getOriginal().getTo() \n // bounce.getOriginal().getSubject() \n // bounce.getOriginal().getText() \n // bounce.getNotification().getFrom() \n // bounce.getNotification().getTo() \n // bounce.getNotification().getSubject() \n // bounce.getNotification().getText() \n // ...\n } catch (MessagingException e) {\n // ...\n }\n }\n }"]]