title: Receiving Email App Engine
body: <p>I have a mail reception problem for my app engine app, I followed the tutorial Google Cloud Platform 
  <a href="https://cloud.google.com/appengine/docs/java/mail/receiving" rel="nofollow">https://cloud.google.com/appengine/docs/java/mail/receiving</a>
  but I can't receive any mail. What I receive is a blank page.</p>
  
  <p>appengine-web.xml</p>
  
  <pre><code>&lt;inbound-services&gt;
    &lt;service&gt;mail&lt;/service&gt;
  &lt;/inbound-services&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code> &lt;servlet&gt;
    &lt;servlet-name&gt;mailhandler&lt;/servlet-name&gt;
    &lt;servlet-class&gt;MailHandlerServlet&lt;/servlet-class&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
    &lt;servlet-name&gt;mailhandler&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/_ah/mail/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;security-constraint&gt;
    &lt;web-resource-collection&gt;
      &lt;web-resource-name&gt;mail&lt;/web-resource-name&gt;
      &lt;url-pattern&gt;/_ah/mail/*&lt;/url-pattern&gt;
    &lt;/web-resource-collection&gt;
    &lt;auth-constraint&gt;
      &lt;role-name&gt;admin&lt;/role-name&gt;
    &lt;/auth-constraint&gt;
  &lt;/security-constraint&gt;
  </code></pre>
  
  <p>servlet <code>ReceiveEmailServlet</code></p>
  
  <pre><code>public class MailHandlerServlet extends HttpServlet { 
      public void doPost(HttpServletRequest req, 
                         HttpServletResponse resp) 
              throws IOException { 
          Properties props = new Properties(); 
          Session session = Session.getDefaultInstance(props, null);
          MimeMessage message =  null;
          try {
              message = new MimeMessage(session, req.getInputStream());
          } catch (MessagingException e) {
              e.printStackTrace();
          }
  
          resp.setContentType("text/plain");
          resp.getWriter().println(message);
      }
  }
  </code></pre>