albertito / chasquid

SMTP (email) server with a focus on simplicity, security, and ease of operation [mirror]
https://blitiri.com.ar/p/chasquid/
Other
868 stars 56 forks source link

Question about catch-all aliases #23

Closed aellwein closed 2 years ago

aellwein commented 2 years ago

Hi,

i have a question about configuration.

For instance, i've already got "foo@mydomain" and "bar@mydomain" addresses defined in my configuration for some specific users, but i want to have a "catch all" rule, which catches mails sent to unresolvable user (e.g. "unknown@mydomain") and delivers them to some configured user (like, mine)?

Is that possible to configure such kind of "catch all" rule for aliases?

albertito commented 2 years ago

At the moment, catch-all isn't supported directly in the aliases file, although I think it's a reasonable feature request.

In the meantime, this is doable via alias hooks. It's not very straightforward, because the output of the hook is added to the results from the file, so you'd have to know which ones already resolve naturally. But it can be done.

Does this help?

Thanks!

aellwein commented 2 years ago

Thanks @albertito,

this definitely helps with my setup, i need to put some logic into the alias hook. I also think this would be a great feature to support out-of-the-box.

Maybe some syntax like:

# here goes the catch-all rule 
_ : someuser

Thanks for the help!

albertito commented 2 years ago

I agree this would be a useful thing to support, I'll leave this open to track that feature request :)

Thanks!

aellwein commented 2 years ago

@albertito I could try to implement this feature, if you welcome any contributions.

albertito commented 2 years ago

Of course! Contributions are always welcome :)

I'll be slow to respond for the next couple of weeks, but will be happy to look at this then (sorry for the bad timing!).

I have to let you know you, though, that implementing this might be trickier than it looks because of how aliases are implemented internally. A non-matching lookup returns the given address, so that would have to be adjusted, but to do that some of the internal recursion logic may have to change.

If you find time to send a patch/make a pull request, that would be most welcome! Other than that, I'll give it a try in about two weeks.

Thanks again!

aellwein commented 2 years ago

@albertito if you find time, the pull request contains basic implementation. I'd be happy if you could review it.

albertito commented 2 years ago

Of course, thanks a lot for the patch! Sorry I've been slow to review, I came back earlier this week but it's been difficult to find the time for it. I will review the patch this weekend.

Thanks again!

albertito commented 2 years ago

Just FYI, and for discoverability: discussion about catch-all is pretty much happening on the pull request #24 .

I'll put a summary here later for reference, but for now let's centralize the discussion in #24 :)

albertito commented 2 years ago

This is now implemented in the next branch, commit f303e43 (it might be rebased in the future).

I'll leave it there for now so it gets more exposure and testing, and then move it to master for inclusion in the next release. I'll leave this issue open until then.

In the meantime, please comment further if you have any suggestions or ideas regarding this feature.

Thanks a lot!

albertito commented 2 years ago

The patch for catch-all aliases is now in the master branch, and will be included in the next release.

Thanks again!