regnull / ubikom

Free, secure communications for everyone, powered by decentralized private identity.
MIT License
67 stars 3 forks source link

When sending email to external users, internal users are removed from To header #50

Closed regnull closed 2 years ago

regnull commented 2 years ago

Which is incorrect... We are doing it to avoid piping emails to external users to the external mail client, but there must be a better way.

regnull commented 2 years ago

Here's the problem. Currently, we strip all the internal addresses from the message before we pipe the message to sendmail. This is done to prevent sendmail from delivering messages to the ubikom recipients, because it will happily do just that. So, if we don't strip the internal addresses, the messages to internal recipients will be delivered twice, first time directly, and the second time via gateway. But if we strip the internal addresses, the external users receive weird messages addressed to no one (if we strip message from To header).

A solution would be to modify gateway receiver to ignore messages originating from Ubikom (because they are already delivered, bypassing gateway).

So, if bob@ubikom.cc sends message to alice@ubikom.cc, and CC to joe@gmail.com, message to alice is delivered directly. Gateway gets the message, and forwards it to sendmail as is. Sendmail sends it to postfix, which pipes it back to gateway. Gateway looks at it, says oh it's from bob@ubikom.cc, so I will just ignore it. Nice.