Disabling e-mail

ict4schools

New member
Joined
Mar 26, 2009
Messages
4
We are using multi hosting servers, with all have mail on them. Sometimes we migrate a domain from 1 server to another. For example, we are mirgrating from Plesk to Directadmin. Now we have a seperate outgoing SMTP server, which is external.

We want to be able to disable mail on specific domains. So the domain won't receive mail internally when the domain is already registered but not yet migrated. So the mail will be send to the old domain, until the migration is complete. Otherwise, the mail, which is send internaly on those servers, will go to the "new" directadmin server, instead of the current server hosting the current mail.

So we like to have an option to disable the mail. Also it will be very handy to check for that as well using the API. So I can use that in a script on the outgoing SMTP server, to blacklist the domains which have mail disabled.

It is like the same behavior as Plesk currently has. But Plesk does not have a nice API like Directadmin for that.
 

OK, I didn't know that feature exists, because I'm doing DNS management from the admin part, not per domain. So I didn't see it. And my search capabilities on that subject where not successfull. Thanks for mention it.

Well than, to my second part of the question, the "Local Mail Server" option. Can I read that from the API? Because, I want to retrieve a list of domains that have the "Local Mail Server" enabled on the server. So, something like CMD_API_SHOW_MAILDOMAINS So we can use that in the outgoing SMTP server.
 
You are probably using the api to do a lot things you don't need an api for. The good thing about the api is that it can be run from any server. But if you are running the api on the server you are modifying then for many things it best not to use the api at all as it is slower.

Local Mail Server option just adds or deletes the domain from the /etc/virtual/domains file. Have your script check that file for the domain. If you don't want any of the domains to have mail on that server then the file should be empty.
 
You are probably using the api to do a lot things you don't need an api for. The good thing about the api is that it can be run from any server. But if you are running the api on the server you are modifying then for many things it best not to use the api at all as it is slower.

Local Mail Server option just adds or deletes the domain from the /etc/virtual/domains file. Have your script check that file for the domain. If you don't want any of the domains to have mail on that server then the file should be empty.

I want to recieve the list of domains who need to recieve their mail on DirectAdmin on the outgoing SMTP server, which is another server. On the outgoing SMTP server the script is running, and using (currently) the API of the DirectAdmin server, to retrieve the domain list. But this includes all domains. So we now manually maintaining a blacklist for every domain which has mail on an other server than the DirectAdmin server. But this is to much of a hassle and not very userfriendly. So we need an option, to get the list of domains on which local mail is enabled, from an external server (the outgoing SMTP).

This is also in preperation for a possible second Directadmin installation, because that will make maintaining the blacklist even worse.
 
I want to recieve the list of domains who need to recieve their mail on DirectAdmin on the outgoing SMTP server, which is another server.

Your statements are a little confusing.

It sounds like to me all you need to do is determine what domains are listed in the /etc/virtual/domains file. These domains are local and any mail being sent from the DA server will deliver the mail locally. If the domain is not in that file then exim will look up the mx record for that domain and deliver the mail there.

If you are using the api then you are familiar with writing scripts. I don't need to teach you to write a script to read the domains file and put it on the DA server for your remote server to access.
 
Your statements are a little confusing.

It sounds like to me all you need to do is determine what domains are listed in the /etc/virtual/domains file. These domains are local and any mail being sent from the DA server will deliver the mail locally. If the domain is not in that file then exim will look up the mx record for that domain and deliver the mail there.

If you are using the api then you are familiar with writing scripts. I don't need to teach you to write a script to read the domains file and put it on the DA server for your remote server to access.

Sorry, my explainations are sometimes very cripple. :o ;)

No, you don't have to teach me scripting. I can script bash, php, python and program as well. And I also do have a mind of my own, so I'm not going to ask for fully working examples or stuff like that. But I think you understand my question the other way around.

I have an outgoing SMTP server, which is not a DirectAdmin server. We are currently having 1 DirectAdmin server and 1 Plesk server and some other servers with email boxes on them. On the outgoing SMTP server I want to run a script, which gets the email domains from DirectAdmin. So the script is not going to run on DirectAdmin itself.

I hope I explained it a bit better now.

Yes, I could use SSH access, by using SSH keys, and use the cat command or something similar to get that file. But I think I'm going to need the function also in a webapplication, so it would be nice if it gets an API call. Or maybe a filter in CMD_API_SHOW_DOMAINS.

This command I can use now, to do the same:
ssh -anqqT admin@directadmin 'cat /etc/virtual/domains'

But it is not as secure (giving fully user access) and cannot be used that securely in webapplications to manage the mail domains.
 
Last edited:
You are making way complicated than it needs to be.

On the outgoing SMTP server I want to run a script, which gets the email domains from DirectAdmin.

You can easily set up a script on the DA machine to read the domains file and tell you what domains are in that file and it can be accessible through the web without SSH or anything like that. You can even have the script require a password so that it does not do anything for the general public.

You can easily set your script on the smtp server to call the script on the DA machine to give it the list of domains.
 
Back
Top