> Whilst writing some automated account creation scripts, I created a test
> domain and then afterwards manually deleted the domain from
That's not good. :)
> Now adding the same domain, it says
> Error: Domain already exists
Yes, because it's still in the qmail configuration.
> Then using bin/vdeldomain to try and remove remnants of it (yeah yeah,
> should have done that instead of rm, I know!), it says
> Error: Domain does not exist
Yes, because it cannot find the domains directory.
I admit these error messages are confusing. However, they wouldn't have
shown up if you didn't break things manually. ;-)
> Confusing, at best. So my question is where does vpopmail store the
> internal configuration?
There is no "internal configuration". vpopmail creates the domain
directory (which you already got used to) and inserts the appropriate
lines into the qmail configuration.
> I manually removed all references to the domain
> from files in /var/qmail/control, but that doesn't seem to be it.
You did right; additionally delete the appropriate line from
/var/qmail/users/assign and run /var/qmail/bin/qmail-newu. Afterwards
you can re-create the domain with vadddomain.