Flolagale / mailin

Artisanal inbound emails for every web app
mailin.io
MIT License
1.95k stars 151 forks source link

Is it possible to forward email #9

Open dux opened 10 years ago

dux commented 10 years ago

from some accounts to some other accounts

just remark, It is really strange that you choose not to add config file for mailing, rather use super simple single route.

why not simple plain text config that would say something like

bot@domain1.com -> http://domain1.com/mail_hook schedule@domain1.com -> http://domain1.com/mail_hook *@domain1.com -> admin@gmail.com info@domain1.com -> destroy

bot@domain2.com -> http://domain2.com/mail_hook *@domain2.com -> admin@gmail.com

Flolagale commented 10 years ago

Well that is an interesting remark. Actually there are two reasons why there is no router inside mailin:

That said, having a powerful routing system would be awesome. This could be implemented as a separate module (mailin-router for instance or maybe we can find a better name). It would be a very simple webapp proxying post requests and forwarding emails based on the config file you described. Interesting modules to base this one are node-http-proxy and node-mailer. What do you think?

dux commented 10 years ago

Simplicity is great thing, and I am all in for that. Workflow can be that app searches for route parameter first, config file second and if nothing is found, raise error.

Regexp based routes are even better, why not :) For posting to web app, yes, but then web app is doing forwarding job that node should do better. I am strong for idea that Mailin does email routing even for multiple domains.

HTTP router is always a possibility but that adds extra layer of complexity. This problem can't be solved with node-http-proxy but node-mailer can be used for email forwarding. For a start maybe it would be best just to use simple json mapping file

{ domain1: { bot:'http://domain1.com/mail_hook', schedule:'http://domain1.com/mail_hook' '_':'owner@gmail.com' }, domain2: { bot:'http://domain1.com/mail_hook', '_':'owner@gmail.com' } }

What do you think, will you add config option? This is few hours work for you but would be great problem solver for a lot of people because you already have spam assassin integrated.

Flolagale commented 10 years ago

Well the post routing should be doable. We just need to define the config file format. What you posted is a good starting point. The mail forwarding is even more interesting in my opinion, but simple-smtp does not allow inbound and outbound emails on the same machine. We have to test, but I think that we would have to use node-mailer with something else than smtp transport.

dux commented 10 years ago

Did not know that for simple-smtp restriction, but so what? We can use sendmail or postfix for outbound as we use it now and mailin for all inbound related tasks. Did I miss something?

2naive commented 9 years ago

Agreed that this feature is needed!

Flolagale commented 9 years ago

Sure it would be really helpful, though I'd like to take a decision on #23 before starting the dev.

stevenvachon commented 8 years ago

+1

davidwieler commented 8 years ago

I love it the way it is. Allows me to write functions that send/forward email based on booleans via the Mandrill API. I'm sure you can use whatever else to forward the emails. I just think leaving it the way it is opens up more possibilities while keeping the library nice and small.