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"]],["最后更新时间 (UTC):2025-03-06。"],[[["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."]]],[]]