ix-ai / smtp

This is a SMTP docker container for sending emails. You can also relay emails to gmail and amazon SES.
MIT License
92 stars 14 forks source link

Use as smarthost with authentication? #25

Closed Waldorf3 closed 1 year ago

Waldorf3 commented 1 year ago

I'm using this container as the outgoing smarthost for my docker containers. The only access to the incoming port is through an internal docker bridge, so until now no need for authentication, however, I'd like to use this also as outgoing mailserver for gmail "send mail as" accounts. I know I can use smtp.gmail.com, but such mail arrives as mail@send.as via real@gmail.account. For this reason I need to be able to authenticate for example by username/password. Is there a way to do this?

tlex commented 1 year ago

Thank you for your question. This project doesn't support authentication, nor does it have it in scope. You can also see my response in #14 for this.

I am willing to accept merge/pull requests for a method to do that, however I think user management will blow up the code base.

Waldorf3 commented 1 year ago

This is only for outgoing relay so running a full MTA would be a huge overkill with incoming mail handling, spam etc. All I need is like a simple .htaccess style access control for allowing relaying of mail. I feel I looked everywhere but it just doesn't look like it exist. Everybody suggest just using gmail as the outgoing relay, but as exactly what I want to avoid.

tlex commented 1 year ago

Well, the problem with doing this with exim (which is the MTA inside this package) is that it needs one more daemon running, to handle the authentication of the users. You can take a look on the old ubuntu wiki page to see the challenges related to adding individual users.

I strongly suggest you look into other MTAs. You don't need to open access for inbound traffic. You don't need to add it to your DNS. But you do need the user handling. There are some very nice projects out there to handle users (also https://mailu.io/2.0/ comes to mind).

Waldorf3 commented 1 year ago

The problem is that total packages like mailcow, mailu etc, take a ton of overhead to run, rather than a few kb. I'm not particularly after exim, any MTA will do. Do you if any other would be hard to setup in this way? I can't believe I'm the only person in the world who are looking for selfhosting something like this, rather than have commercial providers look over their shoulder.

abh commented 1 year ago

The problem is that total packages like mailcow, mailu etc, take a ton of overhead to run, rather than a few kb.

That's what @tlex is saying and that this package isn't appropriate for use cases that'd turn it into that. :-)

I like docker-mailserver for a reasonable trade-off when I need authentication (etc).

Waldorf3 commented 1 year ago

Adding simple username/password authentication is not going to turn ix-ai/smtp into mailcow, come on, be realistic.