anonaddy / anonaddy

Anonymous email forwarding
https://addy.io
GNU Affero General Public License v3.0
3.33k stars 182 forks source link

[Bug] Adding a domain excludes existing aliases #609

Closed luckydonald closed 7 months ago

luckydonald commented 7 months ago

I moved my domain and added the original domain as an alias domain but the domain overview lists zero domains for @firstdomain.com.

Instead, it ideally should list all ~100 existing email aliases. Not ideal, but still an improvement would be to have an "other" category, where those mails in the wrong categorises are listed.


Steps to reproduce:

  1. create host at app.firstdomain.com, with firstdomain.com accepting mail vial MX @.
  2. Send a few mails to test@firstdomain.com, test2@firstdomain.com, test3@firstdomain.com, etc.
  3. move instance to app.newdomain.com
  4. add firstdomain.com as an external domain to an account, going through MX verification and setting updated DNS entries correctly as indicated in the GUI.
  5. observe that test@firstdomain.com, test2@firstdomain.com, test3@firstdomain.com, etc. are listed in the overview, but not included in the domain filter for firstdomain.com, and not included in the count either.
willbrowningme commented 7 months ago

That is because they were created when firstdomain.com was a root domain (can be used by all users) and now you've changed it to a custom domain added to one user's account.

You need to update the database columns for those aliases:

Setting the aliasable_id to the custom domain's ID and the aliasable_type to App\Models\Domain then they will "belong" to that custom domain.

This is an edge case not a bug.