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-06-16 (世界標準時間)。"],[[["To enable email bounce notifications, you must configure your application to receive them and handle them within your app."],["Enable the incoming bounce notification service by adding the `mail_bounce` service within the `inbound-services` section of your `appengine-web.xml` file."],["Map the bounce URL `/_ah/bounce` to your bounce handling servlet within your `web.xml` file to direct bounce notifications appropriately."],["Use the `BounceNotificationParser` class from the JavaMail API to parse incoming bounce notifications in your application."]]],[]]