Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug or Feature] hMS ignoring the catch-all if a route exists #74

Closed
SteffenM-DE opened this issue Jan 16, 2015 · 6 comments
Closed

[Bug or Feature] hMS ignoring the catch-all if a route exists #74

SteffenM-DE opened this issue Jan 16, 2015 · 6 comments
Labels
Milestone

Comments

@SteffenM-DE
Copy link

If you define a route for a hMS domain and define a catch-all address for this domain at the advanced tab the catch-all will never used.

I have defined a route only for several deliver to addresses and so I think hMS should take the catch-all address for not at the route defined addresses. But it do not and send a 'Recipient not in route list'!

Here is the forum thread with all details:
https://www.hmailserver.com/forum/viewtopic.php?f=7&t=27645

User jimimaseye looks at the code and write this: 'I see in the code that it clearly does only one or the other (and the route is first in the list). Cant see why it cant be an if route check match else if catchall check.'

It would be nice if that can changed because it would help routing known addresses and cath-all the unknown!

Regards, Steffen

@OutbackMatt
Copy link

Just re-read the forum thread, AND I still don't get this....

How do you want hMailserver to know when to use the catch all and when to use the route?

@SteffenM-DE
Copy link
Author

Hi Matt.

If the route is for all addresses (register addresses and option deliver to all addresses) than of course only the route is used! But if there are addresses defined for the route (register addresses and option deliver to addresses below) the catch all address can use if the address is not at that list!

So I think you look if there is a route for the address domain. If yes you look if the address is at the route-address-list (register addresses and option deliver to addresses below) and if not you send a 'Recipient not in route list'! Bevor this happens you can look if there is a Catch all defined for this domain and if yes you can send it to the Catch All address.

I hope it is clear now - excuse my poor English, I'm no native English speaker!

It would be nice if that can changed because it would help routing only th known addresses to a backend mail server and cath-all the unknown at a special mailbox!

Regards, Steffen

@OutbackMatt
Copy link

Ahh OK, Now I understand

so what you want is:-
if Local account = deliver locally
Route with Address = deliver via route
Unknown addresses = deliver to local catch-all

IF route has no addresses, then it should precedence over a catch-all (which would essentially be ignored)

@SteffenM-DE
Copy link
Author

Yes, perfect! That is it ...
Actually a route always precedence over local account and local catch-all but if the route is restricted to special addresses you can use the local catch-all if the address is unknown!

@jimimaseye
Copy link

jimimaseye commented Jan 30, 2016

I think the logic should be more like (currently 162 to 202 - hmailserver/hmailserver/source/Server/SMTP/RecipientParser.cpp):

if (pDomain)
{
   String sPostMaster = pDomain->GetPostmaster();
}

if (pRoute)
{
   if (pRoute->ToAllAddresses() || pRoute->GetAddresses()->GetItemByName(recipientAddress))
   {
      if (iRecursionLevel == 1)
         bTreatSecurityAsLocal = pRoute->GetTreatRecipientAsLocalDomain();
         return DP_Possible;
   }
   if (sPostMaster.IsEmpty())
      // We found routes matching the recipients domain, but the recipient
      // doesn't exist in any of them.
      sErrMsg = "550 Recipient not in route list.";
      return DP_RecipientUnknown;
}
// If this is a local domain, try to find a catch-all
// account for this domain.
if (pDomain)
   if (!sPostMaster.IsEmpty())
   {
      // Could not find the address, but a post master was specified,
      // so we'll send to him instead.
      // Found an alias.
      recipientAddress = sPostMaster;
      continue;
   }
}
else
{
   // Domain is not local. SMTPConnection should determine
   // whether the sender is allowed to send.
      return DP_Possible;
}
sErrMsg = CONST_UNKNOWN_USER;
return DP_RecipientUnknown;

ie, checks for and retrieves a postmaster address (if it exist) before checking routes, and then only uses it if the routes check fails

@martinknafve martinknafve added this to the 5.7 milestone Apr 23, 2016
martinknafve added a commit that referenced this issue May 17, 2016
…the route address list, the domain catch-all should be used if specified. #74
@martinknafve
Copy link
Collaborator

Fixed in 5.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants