Fetching all emailaddresses on a server

kristian

Verified User
Joined
Nov 4, 2005
Messages
442
Location
Norway
In the process of setting up an external mailserver to process email before delivering to my DA-server, I'm looking for a way to populate a list of all existing addresses that the mailserver should accept mail for.

Is there an easy way of getting a list of *all* email-addresses that are valid on a given DirectAdmin system?

Things to note:
* Catchall addresses means all addresses are valid
* Majordomo addresses are not really stored anywhere (?)
* Alias-domains have valid email-addresses too
* Probably more

I was planning to use the API to do something like this:

* Fetch all domains (which there seems to be no API-call for)
* Fetch all email-options/settings for each domain

Instead, it looks like I have to do this:

* Recursively fetch all users created by other users
* Fetch all domains owned by the list of users I now have
* Fetch all email-options/settings for each domain

Am I way off here, or is this the way to do it?

Thanks for any pointers or ideas.
 
Both ways seem to be OK.

p.s. majordomo lists names can be found in /etc/virtual/<domainname>/majordomo/lists/
e.g. /etc/virtual/domain.com/majordomo/lists/mylist, where [email protected] is a list.

UPD: Remember about email redirects.
 
Don't forget per-user alias files.

All usernames in /etc/passwd accept mail unless otherwise blocked.

If you're using mbox email boxes, they're not created until after an email is received.

If you're using Maildir I'm not sure whether any of the directory chain is prepopulated or not; perhaps someone who's already checked can tell us.

Of course a completely different way of doing it would be to have your external mailserver check to see if it can deliver mail to a user before accepting mail for that user.

In otherwords, after the recipient is known, check to see if the mail is deliverable on your DirectAdmin server; if yes, accept, if not, refuse.

Jeff
 
Don't forget per-user alias files.
All usernames in /etc/passwd accept mail unless otherwise blocked.

If you're using mbox email boxes, they're not created until after an email is received.

If you're using Maildir I'm not sure whether any of the directory chain is prepopulated or not; perhaps someone who's already checked can tell us.

Is any of this information that I cannot get through the API? I would like to stick with the API as much as possible, to have a well defined interface to talk to.


Of course a completely different way of doing it would be to have your external mailserver check to see if it can deliver mail to a user before accepting mail for that user.

Yes, it had crossed my mind. My mailfilters are running postfix, so I looked into it to see if I could find some good documents describing it, and found this howto:

http://www.postfix.org/ADDRESS_VERIFICATION_README.html

I will take a look at that also. Somehow it feels like a more appealing solution. :)
 
Is any of this information that I cannot get through the API? I would like to stick with the API as much as possible, to have a well defined interface to talk to.
As I recall, DirectAdmin doesn't interface with the alias files. So it probably doesn't have an api call for them. But any user with the knowhow and ftp can create an alias file.

So alias files are worth considering.

Jeff
 
Back
Top