开发者

Accepting emails from domain with wildcard subdomain

I'm setting up an app to preform mailhooks. You create an account, assign a callback url, and a pattern to match. Then you get a subdomain that you can send email to. Something like accountname.mail.appdomain.com.

This is how it might work.

  • Pattern: ^(?P\w+)-reply$
  • Account: accountname
  • Callback: http://www.someotherapp.com/reply/create/

If someone sends an email to 12345-reply@accountname.mail.appdomain.com I need to be able to collect that email in I guess a catch all mailbox. Then have a background job that fetches mail and routes them based on the TO address and custom domain.

The problem I am running into is how to get the email server to accept these incoming emails. Right now I have a MX record set up that points from *.mail.appdomain.com to mx1.emailsrvr.com and mx2. When I "dig" I get the correct routing however I don't think the email server is set up to accept the incoming mail.

If this is not possible another option I have been playing with is creating a python smtp server using the built-in smtp lib. All this server would do is accept incoming requests to port 25 and plac开发者_开发技巧e the mail in a queue. I have that working fine I'm just worried that not using a real smtp server might create problems.

BTW: The main server will be running on slicehost, if that matters. ALSO: This server is not going to be sending email from these custom domain, if that matters.


What you need is a dynamic configuration of your mail server, right? Then this depends on your mail server capabilities. If you use Postfix then you could add virtual domain setup being configured in MySQL tables. Or other databases. From within your application you then only need to add/remove rows in these tables to accept only the valid domains. Same goes for Exim which is even more extensible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜