setting up email with extern domain/DNS host

Pierre Knudsen 8 years ago updated 8 years ago 24
i'm now using Ajenti for about some months. Until now i never used the email section, but some of my friends needs a webspace with email, so we hosted it on my server.
We started with a website, added the Domain and everything works. But if we create an Email account, we can only connect to it and see the inbox, but we can't send or receive emails.

The domain isn't hosted local, but on a extern DNS hoster. So we created a DNS record (not sure if it's needed). The question is now, what do i need to add/do, to get the thing to work ?

Thanks for all persons who answer

Greetings Pierre
you cant send or receive ,becuz your domain mx record shoud point on your ip server
i use bind9 dns server,and point mx record to my server ip,

Thanks for you fast answer.

Could u maybe give me an example, what i should add in Bind9, that the mailserver is local, but the domain external ?

already tried some things, but couldnt get it to work. Not sure if i need to add a new zone or add the mx record like mailserver ip to an existing zone.

Greetings Pierre
Actually , i didnt get your point, my english is bad
can you explain more to get me understand

what do you mean by "The domain isn't hosted local"

i have serveral customer and all of them using mail ,every thing is fine
i think i can help you

sorry for my bad English
I mean that my server ist on "host 1" on "hoster 1"
and my friends domain is on "host2" on "hoster 2" (Host2 doesn't have mailserver)

The Webserver and Mailserver are on "Host1", so we want that we can send mails, with the Domain from "Host2".
Can you send or recieve from domain on host1, if you can, so you shoud point your external domain mx records to your mail server host,
if you wann recieve mail from another domain , is not hosted on your same server
you shoud only point mx record, to your domain

tell your customer, point their mx record on your domains
external-domain.com. MX 10 mx1.your-mail-server-domain.net.


if you cant get this work try this
i think in ajenti you shoud create zone for external domain , in bind
and config your external domains, config a record on host2 and config mx record on host1
like this

$TTL 604800
@ IN SOA ns.external-domain.net. external-domain.net. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; name servers - NS records
IN NS ns1.external-domain.net.
IN NS ns2.external-domain.net.

; name servers - A records
ns1 IN A host2
ns2 IN A host2

; main - A records
@ IN A host1
external-domain. IN A host2

; mx records
external-domain.com. MX 10 host1

After changing and saving, Bind9 stopped working. I get the msg:

Stopping domain name service...: bind9rndc: connect failed: connection refused. ok
[FAIL] Starting domain name service...: bind9 failed!

removing the record/zone didnt helped.
reanstalling didnt helped too


Got another error:


[Errno 2] No such file or directory: '/etc/bind/named.conf' Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/ajenti/plugins/main/main.py", line 158, in handle_message self.ui.dispatch_event(update['uid'], update['event'], update['params']) File "/usr/lib/pymodules/python2.7/ajenti/ui/__init__.py", line 72, in dispatch_event self.root.dispatch_event(uid, event, params) File "/usr/lib/pymodules/python2.7/ajenti/ui/element.py", line 382, in dispatch_event if child.dispatch_event(uid, event, params): File "/usr/lib/pymodules/python2.7/ajenti/ui/element.py", line 378, in dispatch_event self.event(event, params) File "/usr/lib/pymodules/python2.7/ajenti/ui/element.py", line 402, in event getattr(self, 'on_%s' % self_event)(**(params or {})) File "/usr/lib/pymodules/python2.7/ajenti/plugins/main/main.py", line 381, in on_switch child.broadcast('on_page_load') File "/usr/lib/pymodules/python2.7/ajenti/ui/element.py", line 356, in broadcast getattr(self, method)(*args, **kwargs) File "/usr/lib/pymodules/python2.7/ajenti/plugins/bind9/main.py", line 76, in on_page_load self.refresh() File "/usr/lib/pymodules/python2.7/ajenti/plugins/bind9/main.py", line 79, in refresh self.config.load() File "/usr/lib/pymodules/python2.7/reconfigure/configs/base.py", line 37, in load self.content = open(self.origin, 'r').read() IOError: [Errno 2] No such file or directory: '/etc/bind/named.conf'
if you didnt add custom zone, delete all zones, restart bind
if you miss spell somthing or set path wrong , bind never start , and stop working
The only thing i did, was to set a new zone. but trying to do, what u said
ok,delete all zones, and restart bind
configure bind its very defecult ,if you miss spell something ,every thing goes wrong
you should have experiense to deal with it,
ok thanks, bin is noww working again. a new zone file gets auto created named: 0.in-addr.arpa for file /etc/bind/db.0 . the old Default ones doesnt get created, but i dont think that will be a problem or ?. everything running now. trying to get the mx zone to work now :)

thanks alot, that you helped me with my problems!
its my honor to help you , ur wlc
sorry for my bad english , and bad support
Ok could fix the problem with the Crash msg. Had a small backup. but Bind still not working.

http://prntscr.com/7gz94e a picture of all zones, is there something missing from the defaults ?

there always comes a 2 0.in-addr.arpa zone on fail restart. And a 3. if i try again
thats zone , its for ajenti, ajenti will automatically create them, its ok
Still happens, everytime i add a new zone and restart the bind server, it wont start :/
The only zone is : 0.in-addr.arpa
if i create a new: example.net.
it autocreates a 2. 0.in-addr.arpa after saving the example.net

after a restart the server doesnt start again and i need to delete all zones.


found out, that it creates the 0.in-addr.arpa if i click on Save
it dosent matter, i dont know what is wrong with ajenti, and i dont know why creating this zones

That's because of ajenti error
enter full path for file input , like this

and make sure you create file and , save it corectly

changed the file path and it worked :D

btw. "sorry for my bad english , and bad support", np, my english isn't the best too and that you are a bad support isnt right. U helped me alot ^^
i will be happy to help, ur wlc
just a small thing. I can now recieve mails, but cant send any mails. already tried to change the port, but still didnt worked. do u maybe know, where the problem is ?
Ok great, can now recieve mails.
need to try later to send mails, because my webmail panel got some problems right now.
check exim and courier log, and make sure exim and courier is started
Here do i find the Courier log ?
exim log was in /var/log/exim , but didnt found some errors.
In th Interface Exim, Courier-imap, courier-imap-ssl and courier-authdaemon are running.

found something like fetchmail (not sure if its needed) but cant start this programm
found sendmail too, but normaly this gets removed by ajenti, in the console it says its not on server more, but if i look in ajenti Services, sendmail is running and cant be stopped.

if i use the command to stop sendmail, it gives me
~# service sendmail stop
[ ok ] Stopping Mail Transport Agent (MTA): sendmail.
but it doesnt stop, still shows active

if i try to start sendmail it says
[....] Starting Mail Transport Agent (MTA): sendmailstart-stop-daemon: unable to stat /usr/sbin/sendmail-mta (No such file or directory)/etc/init.d/sendmail: 296: /etc/init.d/sendmail: /usr/sbin/sendmail-msp: not found
. ok

where do i find the Courier log ?*