Enough-Software / enough_mail

IMAP, POP3 and SMTP clients for Dart developers. Contains both low level as well as a high level API.
Mozilla Public License 2.0
105 stars 55 forks source link

Request | SMTP Proxy #156

Open KevinBLT opened 3 years ago

KevinBLT commented 3 years ago

Hello again,

we had the idea of implementing a small "SMTP Proxy" with the following ideas behind it:

Image a company X and Users A,B,C.

Each of users will set there SMTP server as mail.company.domain where this "SMTP Server" is not the real one already but a proxy that can or does perform the following tasks:

The mail will then be sent (in our case) to the "Real SMTP server" on localhost. This will enable full featured sending/receiving in any mail client incl. mobile and every sent mail has our custom design. Another idea was to read and find the "Reply levels" and convert them to a chat style optic with "bubbles" left and right.

Internally: Read the SMTP Lines from TCP put them into a "enough mail message" processs the message and send to the real smtp (using the same credentials).

I will use enough_mail for the sending part but was wondering if this would be a new good feature in general?

What would you say? I would be glad for some small cooperation with the SMTP protocol since you've already implemented the client side of it, I thought it would be a rather easy work to also understand the server side stuff (and I think alle those "decoding" stuff is already in here?)

Thanks in advance

Kevin

robert-virkus commented 3 years ago

Hi Kevin,

I like. I had some similar ideas for the client side, ie I want to enable message templates for my mail app. Companies should then be able to specify their own templates similar to how they can already define their company wide signature in an extension.

The benefit of your solution is of course the enforcement and additional checks that can be done.

I wonder how to deal with clients and incoming messages at the same time, ie when you listen on the SMTP port and your DNS records point to the proxy server, then the proxy server will have to deal with incoming mails, too, doesn't it?

Have you checked out offerings like MailChimp, RapidMail or MailJet etc? AFAIK these are all different products than the one you have in mind, but they also share some similarities.

If you want, we can also discuss this 1:1, just send me a message to robert-at-enough-dot-de.

robert-virkus commented 3 years ago

Forgot to write: converting the plain text part of a message should be simple enough, html messages could become somewhat trickier...

KevinBLT commented 3 years ago

I will contact you! :-)

My idea would be to create an alternate Socket and use this in any mail client as SMTP server. I don't want to to interfere with the mail server. I personally prefer self hosted solution as we are currently moving all service to private hosting solutions for data security reasons (we have some special customers).

So far as I can see, when the SMTP is read, a mime message can be created by decodeding the data - to get the "normal html" - then use package:html to do some stuff or whatever and forward a standard message via enough_mail. The only "additional" tricky part is "act as smtp server" - so mainly the reverse side of what you've already done and then call decode where encode has been called before. When the message is read internally - we can use your lib as always and I think this fantastic. All our employees have to do is set the smtp server to another address/port and that's all. Image exchange, signing and reformating into our CI mail design is done automatically and every can keep using outlook/apple mail or what ever.