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){// ...}}}