如果没有匹配的处理程序,Lamson/Salmon 会将邮件放入无法投递的队列中。但是,我不能完全使用路由装饰器的正则表达式来进行匹配,因为我需要使用来自例如数据库的信息来验证地址。因此,我需要能够将地址无效的邮件从处理程序放入无法投递的队列中。我怎样才能做到这一点?
我的处理程序看起来像:
@route("(address)@(host)", address=".+", host="example\.com")
@stateless
def START(message, address=None, host=None):
# Here is a complex validation of the address.
# It uses, for instance, information from a database.
# If the address is valid, mail is sent and the function returns
# The code ends up here if the address wasn't valid.
# How can I put the mail into the undelivarable queue?