importcom.google.appengine.api.mail.BounceNotification;importcom.google.appengine.api.mail.BounceNotificationParser;importjava.io.IOException;importjava.util.logging.Logger;importjavax.mail.MessagingException;importjavax.servlet.http.HttpServlet;importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse;publicclassBounceHandlerServletextendsHttpServlet{privatestaticfinalLoggerlog=Logger.getLogger(BounceHandlerServlet.class.getName());@OverridepublicvoiddoPost(HttpServletRequestreq,HttpServletResponseresp)throwsIOException{try{BounceNotificationbounce=BounceNotificationParser.parse(req);log.warning("Bounced email notification.");// The following data is available in a BounceNotification object// bounce.getOriginal().getFrom() // bounce.getOriginal().getTo() // bounce.getOriginal().getSubject() // bounce.getOriginal().getText() // bounce.getNotification().getFrom() // bounce.getNotification().getTo() // bounce.getNotification().getSubject() // bounce.getNotification().getText() // ...}catch(MessagingExceptione){// ...}}}
[[["容易理解","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-08-19 (世界標準時間)。"],[[["\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,[]]