我已经设置了appengine以允许传入邮件,如果我有我的web.xml文件
<servlet>
<servlet-name>mailhandler</servlet-name>
<servlet-class>VerifyReply</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mailhandler</servlet-name>
<url-pattern>/_ah/mail/*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<url-pattern>/_ah/mail/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
它运行并运行VerifyReply servlet,但是如果我想将传入的电子邮件限制为仅发送到verifyreply @ ...电子邮件地址的那些(注意url-pattern与上面不同)
<servlet>
<servlet-name>mailhandler</servlet-name>
<servlet-class>VerifyReply</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>mailhandler</servlet-name>
<url-pattern>/_ah/mail/v*</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<url-pattern>/_ah/mail/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
它停止工作,我收到一封电子邮件退回给发件人。我的日志页面显示服务器已运行/ _ah / mail / verifyreply @ ...但它没有运行servlet并退回电子邮件。
任何想法,我想我都遵循https://developers.google.com/appengine/docs/java/mail/receiving
指南答案 0 :(得分:0)
根据docs,不支持过滤地址:
When App Engine moved to a standard Java Web Server, the ability to specify richer matching patterns was lost (e.g. one used to be able to specify a url-pattern like /_ah/mail/support*). If such pattern matching is desired, consider using a filter-based approach based on the following code snippets.
它会认为指定完整地址确实有效。该页面包含一个如何在邮件处理程序过滤器(servlet意义上的过滤器)中进行地址匹配的示例。您应该匹配那里的地址,如果您不想接受该消息,则返回404。或者,如果你不关心弹跳它们,你可以忽略你不想要的消息。