3
Issue with empty aliases
Problem reported by Sébastien Riccio - 8/14/2024 at 2:04 AM
Resolved
Hello,

When an alias points to a local mailbox, and that local mailbox is deleted, it is removed from the alias.
While I understand the idea behind this, it brings more problem that it resolves.

1) For example when a mailbox is part of multiple aliases and you have for some reason to delete/recreate this mailbox, you'll have to re-add them to all aliases it used to be part of. (and you often forget to do it)

2) When an alias has the deleted mailbox as the only target recipient, the alias remains existing but with 0 "members".
This is a HUGE problem because when you send a mail to this alias, it just simply does NOTHING.
No delivery, no bounce back, the mails just silently goes to /dev/null.

Please make it optional that deleting a mailbox removes it from aliases or at least when an alias is left with 0 members, completly delete the alias so at least it bounces back.

Thank you

Sébastien Riccio
System & Network Admin

13 Replies

Reply to Thread
0
Kyle Kerst Replied
Employee Post
I could also see scenarios where you'd want to delete the user but add a matching alias for that account so mail still gets delivered somewhere should anyone reach out to them and in that case you might still want the address part of those aliases. The issue is that we get requests to adjust it both ways. Lots of administrators want us to manage those settings for them because rooting through aliases cleaning up deleted accounts is tedious. But, for every one of them I'm sure there is another administrator who manages those things meticulously and so wants that control. I'm curious to see which way people vote on this suggestion. 
Kyle Kerst IT Coordinator SmarterTools Inc. www.smartertools.com
0
Sébastien Riccio Replied
Kyle,

At least it should be not possible to have an alias with 0 target, SILENTLY dropping mails without anyone knowing it. This is the real problem here.

For example in your cleaning procedure, if after removing the target from the alias, the aliasis now empty, remove it, so it will at least bounce back.

Or in the delivery procedure that looks up entries in the alias, makes it bounce if alias count < 1, with a message like "There is no destination for this alias" or something like this.

But what it is doing now is the worst scenario, silently dropping mail.
Our customer now ask us how to recover the mails that he received to his zeroed alias and went to void.
Sébastien Riccio System & Network Admin https://swisscenter.com
0
JerseyConnect Team Replied
Maybe SmarterMail should tell you that the mailbox is in use, show you where it's in use, and also give you the option to proceed with the deletion anyway. This way admins have the option to manually remove the associations or just let them get ripped out. As a bonus you have a list of the associations should you want to recreate them.
I know there are other platforms that work in this way, warning or outright blocking you from removing objects that have associations. Not sure if SmarterMail is built in a way that allows that.
2
Sébastien Riccio Replied
Yes there are many software vendors that are issuing a warning when you try to delete an object that is referenced somewhere else.

I think they could do it by adding a check to the API endpoint used to delete the object (mailbox in this case) that returns an error if the object is referenced in aliases, for example.

But doing this would also probably break somehow API compatibility for existing control panels using SM API.

Maybe adding an optional paramenter that defaults to false such as "checkReferences" that would only be set to true when called from Admin UI, or control panels that are aware as such a change.

But IMHO, again, I think a first step to workaround this issue would be at least to bounce back if a mail is sent to an alias that has 0 target.
It would at least notify the sender that the mail was not delivered so they can inform their recipients of the issue. At the moment everything is done silently.

I think actually sending to an alias just loops over the list of alias of targets and as there is 0 target it just doesn't enter the loop and exit without any error.

That being said, I now have to create a small script that will check every alias exxisting in every domains we host, to check if they have at least one target....

Sébastien Riccio System & Network Admin https://swisscenter.com
0
Zach Sylvester Replied
Employee Post
Hello, 

Thank you for reaching out again regarding this issue. I have created a development task to resolve this issue. The expected behavior is that if the alias is empty, the message should bounce.

Kind Regards,
Zach Sylvester Software Developer SmarterTools Inc. www.smartertools.com
0
Sébastien Riccio Replied
# Auth to SM API as server admin
me = SMAPI(ADMIN_USER, ADMIN_PW, SM_URL)

# Get list of existing domains
try:
    all_domains = me._get("/api/v1/settings/sysadmin/domains")["data"]
except Exception as e:
    print(f"ERROR: An error occurred while getting a list of existing domains: {e}")
    exit(1)

print(f"Domains count: {len(all_domains)}")

for domain in all_domains:
    # Set domain context
    sm_domain_header = {"X-SmarterMailDomain": domain['name']}

    # Get domain "aliases"
    if domain['aliasCount'] > 0:
        aliases = me._get("/api/v1/settings/domain/aliases", other_headers=sm_domain_header)[
            'gridInfo']
        if aliases and len(aliases) > 0:
            for alias in aliases:
                if "targets" not in alias or not alias["targets"] or len(alias["targets"]) < 1:
                    print(f"Alias {alias['name']}@{domain['name']} has no targets")

        else:
            print(f"Strange error: {aliases}")


Returned on our server 45 alias with no target. I checked a few with the admin UI and they are indeed empty...

I guess they are leftover from account deletion or deletion/recreation without readding the target to the alias...

Zach, that would really be a step a ahead that it bounces back, yes. Thanks you.
Sébastien Riccio System & Network Admin https://swisscenter.com
0
Andrew Barker Replied
Employee Post
Sébastien,

Keep in mind that an alias can be configured to point to all domain users with no listed targets. For the API call you are using, you should be able to check that setting based on the includeAllDomainUsers property for each alias. The script you posted would incorrectly identify aliases with that configuration as empty.
Andrew Barker Software Developer SmarterTools Inc. www.smartertools.com
0
Sébastien Riccio Replied
Hello Andrew,

Thank you for mentioning this. You're right I forgot to take this into account. I'll add an additional check to be safe.

I think it won't change the results I have though, because our users have no access to the domain administrator account and use our control panel to add aliases and we don't provide this option to them.

Kind regasrds

EDIT: modded the script to take this into account

            for alias in aliases:
                if alias["includeAllDomainUsers"] is True:
                    print(f"Alias {alias['name']}@{domain['name']} points to all domain mailboxes")
                    continue
                if "targets" not in alias or not alias["targets"] or len(alias["targets"]) < 1:
                    print(f"Alias {alias['name']}@{domain['name']} has no targets")

It found one alias with this enabled (on one of our employee test domain) the other ones are still showing as with no target.
Sébastien Riccio System & Network Admin https://swisscenter.com
2
Sébastien Riccio Replied
Andrew,

I think I remember why we historically did not support this alias option in our control panel. If I remember correctly it would also send the mail to domain adimistrator accounts and as we don't give direct access to it to our customers (to keep control on what they can enable or not on their domain), it would flood the domain admin mailbox with mails.

Also in practice, most of the times a customer wants an alias that points to all domain users, they also say: All domain users except these 3 mailboxes that should not receive it. As far as I know there is no way to say all domain users but with exceptions...

For example if they have mailbox accounts for their scanner, or some software that must send mail notifications, etc.

For this there would need some flag on the mailbox itself, such as "doNotIncludeMeInAllDomainUsersAliases" which could be a solution to workaround these both "issues" with this functionality.

Kind regards
Sébastien Riccio System & Network Admin https://swisscenter.com
1
Brian Kropf Replied
We would love to see a feature added that allows us to set an Alias to send to All Domain Users EXCEPT exclude user1@, user2@ etc. This would allow us to exclude our administrative and service accounts but still automatically include new users as they are added to the domain.
1
Zach Sylvester Replied
Employee Post
Hey Brian, 

I think this is a good idea as well. We have added it to the development backlog. 

Kind Regards, 
Zach Sylvester Software Developer SmarterTools Inc. www.smartertools.com
0
Gabriele Maoret - SERSIS Replied
Gabriele Maoret - Head of SysAdmins at SERSIS Currently manages 6 SmarterMail installations (1 in the cloud for SERSIS which provides services to a few hundred third-party email domains + 5 on-premise for customers who prefer to have their mail server in-house)
1
Matt Petty Replied
Employee Post
We've got a fix in place for sending a bounce to senders that send to aliases with no targets. It will NOT be in the build for this week. Don't think anyone wanted a last minute spool change for this build, so it should be in the next.
Matt Petty Senior Software Developer SmarterTools Inc. www.smartertools.com

Reply to Thread