Setting up mail

Discussion in 'Installation/Configuration' started by terryoleary1981, Jun 11, 2008.

  1. terryoleary1981

    terryoleary1981 New Member

    Hi i've had ISPconfig working for my website since January but i still cannot figure out the mail side of things.

    I've followed the tutorial to the letter on here, and have tried various DNS entries with my registrars but i can still not receive any email.

    I've changed a few things and now i get this error 5.1.2 Bad destination host 'DNS Hard Error'. I've looked this up and it is supposed to be an A-record problem but my domain has an a-record and i can see the sites perfectly well.

    I'm now stumped.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    1) Make sure that there is a DNS MX Record for the domain, pointing to the hostname of your server.
    2) If your server is not in a datacenter, ask your provider if they block smtp traffic on port 25
    3) If you send a email to your server, does any additional lines appear in the mail.log file.
     
  3. terryoleary1981

    terryoleary1981 New Member

    Hi still no joy with this, I've checked with my ISP and as i'm a static ip my port 25 is open. I've put some DIG outputs below as i'm probably setting the wrong DNS settings :eek:/

    [root@wallace ~]# dig ns spongecat.com

    ; <<>> DiG 9.4.2 <<>> ns spongecat.com
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55963
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

    ;; QUESTION SECTION:
    ;spongecat.com. IN NS

    ;; ANSWER SECTION:
    spongecat.com. 70086 IN NS ns2.hosteurope.com.
    spongecat.com. 70086 IN NS ns.hosteurope.com.

    ;; ADDITIONAL SECTION:
    ns.hosteurope.com. 3497 IN A 212.67.202.2

    ;; Query time: 3 msec
    ;; SERVER: 135.196.0.6#53(135.196.0.6)
    ;; WHEN: Fri Jun 13 12:57:33 2008
    ;; MSG SIZE rcvd: 93

    [root@wallace ~]# dig mx spongecat.com

    ; <<>> DiG 9.4.2 <<>> mx spongecat.com
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53505
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 17

    ;; QUESTION SECTION:
    ;spongecat.com. IN MX

    ;; ANSWER SECTION:
    spongecat.com. 69888 IN MX 10 spongecat.com.
    spongecat.com. 69888 IN MX 20 mx1.123-reg.co.uk.

    ;; AUTHORITY SECTION:
    spongecat.com. 69888 IN NS ns.hosteurope.com.
    spongecat.com. 69888 IN NS ns2.hosteurope.com.

    ;; ADDITIONAL SECTION:
    spongecat.com. 69888 IN A 87.194.223.165
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.117
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.118
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.119
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.120
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.121
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.123
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.124
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.125
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.126
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.109
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.110
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.111
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.114
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.115
    mx1.123-reg.co.uk. 2237 IN A 195.224.48.116
    ns.hosteurope.com. 3509 IN A 212.67.202.2

    ;; Query time: 7 msec
    ;; SERVER: 135.196.0.6#53(135.196.0.6)
    ;; WHEN: Fri Jun 13 13:00:51 2008
    ;; MSG SIZE rcvd: 398


    are the above entries right?
     
  4. falko

    falko Super Moderator Howtoforge Staff

    That looks ok. What happens in the mail log when you send an email to your server?
     
  5. terryoleary1981

    terryoleary1981 New Member

    Hi I followed the tutorial about DNS setup at http://www.howtoforge.org/ispconfig_dns_godaddy and realised i may have set my DNS records up incorrectly, and also didnt have port 53 open on my router to allow dns access. I've changed all these and re run my dig and got the following outputs:

    [root@wallace ~]# dig ns spongecat.com

    ; <<>> DiG 9.4.2 <<>> ns spongecat.com
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8329
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;spongecat.com. IN NS

    ;; ANSWER SECTION:
    spongecat.com. 79253 IN NS 192.168.1.108.

    ;; Query time: 3 msec
    ;; SERVER: 135.196.0.6#53(135.196.0.6)
    ;; WHEN: Mon Jun 16 21:00:18 2008
    ;; MSG SIZE rcvd: 58

    -----------
    [root@wallace ~]# dig mx spongecat.com

    ; <<>> DiG 9.4.2 <<>> mx spongecat.com
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25748
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;spongecat.com. IN MX

    ;; ANSWER SECTION:
    spongecat.com. 78904 IN MX 10 www.192.168.1.108.

    ;; AUTHORITY SECTION:
    spongecat.com. 78904 IN NS 192.168.1.108.

    ;; Query time: 4 msec
    ;; SERVER: 135.196.0.6#53(135.196.0.6)
    ;; WHEN: Mon Jun 16 21:06:07 2008
    ;; MSG SIZE rcvd: 78

    Firstly does this output still look ok? The website seems to have stopped working now :eek:/ (192.168.1.108 is actually the internal IP of my web server, but i used my external IP in all the dns settings).
     
  6. terryoleary1981

    terryoleary1981 New Member

    I've just checked my ISPConfig management settings and the ISPConfig IP address was set to the internal IP of the server, am i right in thinking this should be set to the external IP?
     
  7. falko

    falko Super Moderator Howtoforge Staff

    In the management settings you must use the internal IP address, but for the DNS records you must use your public IP address.
     
  8. terryoleary1981

    terryoleary1981 New Member

    thanks for highlighting that!

    I'm confused as to why when i dig the nameserver for spongecat.com my internal IP comes up as the record as opposed to the external IP i've set it to.. as a result i cant see my website now let alone get email.
     
  9. terryoleary1981

    terryoleary1981 New Member

    seems the nameservers are finally propagated and i can see my website again. But i'm not able to receive email only send it. When i send an email to [email protected] i get the following bounce back.


    Code:
      <[email protected]> (spongecat.com: No greeting from remote host)
    I've been informed port 25 is open by my provider and it is open on my router, I've tried to telnet the server on port 25 but connection was refused. Or could there be another reason? :confused:
     
    Last edited: Jun 18, 2008
  10. terryoleary1981

    terryoleary1981 New Member

    after speaking to my broadband supplier port 25 is defintely open on their network so something must be stopping the mail getting through, can anyone give me some pointers of what to do or where to check?
     
  11. terryoleary1981

    terryoleary1981 New Member

    after speaking to my broadband supplier port 25 is defintely open on their network so something must be stopping the mail getting through, can anyone give me some pointers of what to do or where to check? It doesnt look like there is an mx record when i dig mx spongecat.com but i have a record on the server.
     
  12. falko

    falko Super Moderator Howtoforge Staff

    This is what I'm getting:
    Code:
    server1:~# telnet spongecat.com 25
    Trying 87.194.223.165...
    telnet: Unable to connect to remote host: Connection refused
    server1:~#
    What are the outputs of
    Code:
    netstat -tap
    and
    Code:
    iptables -L
    ?
     
  13. sagor

    sagor New Member

    Just a long shot guess:
    Do you have a router/firewall between ISP and your server? Make sure port 25 is forwarded to your mail server. If your web sites are working, then either you have already configured your router for port 80, or have none at all.

    If Falko cannot telnet to your port 25, then nothing else will get there either.
     
  14. terryoleary1981

    terryoleary1981 New Member

    here are the outputs

    Code:
    login as: root
    [email protected]'s password:
    Last login: Wed Jun 18 20:18:06 2008 from bertha.lan
    [root@localhost ~]# netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
    tcp        0      0 localhost:2208              *:*                         LISTEN      1894/hpiod
    tcp        0      0 *:5801                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 *:mysql                     *:*                         LISTEN      2016/mysqld
    tcp        0      0 *:5901                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 *:sunrpc                    *:*                         LISTEN      1666/rpcbind
    tcp        0      0 *:hosts2-ns                 *:*                         LISTEN      2646/ispconfig_http
    tcp        0      0 *:6001                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 localhost.localdomai:domain *:*                         LISTEN      7262/named
    tcp        0      0 localhost:domain            *:*                         LISTEN      7262/named
    tcp        0      0 localhost:ipp               *:*                         LISTEN      1911/cupsd
    tcp        0      0 localhost:smtp              *:*                         LISTEN      18369/master
    tcp        0      0 localhost:rndc              *:*                         LISTEN      7262/named
    tcp        0      0 *:51804                     *:*                         LISTEN      1687/rpc.statd
    tcp        0      0 localhost:2207              *:*                         LISTEN      1899/python
    tcp        0      0 *:imaps                     *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:pop3s                     *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:pop3                      *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:imap                      *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:http                      *:*                         LISTEN      2691/httpd
    tcp        0      0 *:6001                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 *:ftp                       *:*                         LISTEN      18163/proftpd: (acc
    tcp        0      0 *:ssh                       *:*                         LISTEN      1925/sshd
    tcp        0      0 localhost.localdomain:ipp   *:*                         LISTEN      1911/cupsd
    tcp        0      0 localhost.localdomain:rndc  *:*                         LISTEN      7262/named
    tcp        0      0 *:https                     *:*                         LISTEN      2691/httpd
    tcp        0    592 localhost.localdomain:ssh   Bertha.lan:naap             ESTABLISHED 4484/0
    [root@localhost ~]# iptables -L
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    [root@localhost ~]#
    
    I do have my router sitting between the internet and the webserver, but i have setup rules for port forwarding for various ports including 25 and 110 for mail.
     
  15. falko

    falko Super Moderator Howtoforge Staff

    Here's the problem: Postfix is listening on localhost only. Please run
    Code:
    postconf -e 'inet_interfaces = all'
    /etc/init.d/postfix restart 
     
  16. terryoleary1981

    terryoleary1981 New Member

    HI

    I've run that command, still not recieving emails:

    Code:
    login as: root
    [email protected]'s password:
    Last login: Sun Jun 22 17:51:48 2008 from bertha.lan
    [root@localhost ~]# netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
    tcp        0      0 localhost:2208              *:*                         LISTEN      1894/hpiod
    tcp        0      0 *:5801                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 *:mysql                     *:*                         LISTEN      2016/mysqld
    tcp        0      0 *:5901                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 *:sunrpc                    *:*                         LISTEN      1666/rpcbind
    tcp        0      0 *:hosts2-ns                 *:*                         LISTEN      2646/ispconfig_http
    tcp        0      0 *:6001                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 localhost.localdomai:domain *:*                         LISTEN      7262/named
    tcp        0      0 localhost:domain            *:*                         LISTEN      7262/named
    tcp        0      0 localhost:ipp               *:*                         LISTEN      1911/cupsd
    tcp        0      0 *:smtp                      *:*                         LISTEN      20766/master
    tcp        0      0 localhost:rndc              *:*                         LISTEN      7262/named
    tcp        0      0 *:51804                     *:*                         LISTEN      1687/rpc.statd
    tcp        0      0 localhost:2207              *:*                         LISTEN      1899/python
    tcp        0      0 *:imaps                     *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:pop3s                     *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:pop3                      *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:imap                      *:*                         LISTEN      2046/dovecot
    tcp        0      0 *:http                      *:*                         LISTEN      2691/httpd
    tcp        0      0 *:6001                      *:*                         LISTEN      2316/Xvnc
    tcp        0      0 *:ftp                       *:*                         LISTEN      8238/proftpd: (acce
    tcp        0      0 *:ssh                       *:*                         LISTEN      1925/sshd
    tcp        0      0 localhost.localdomain:ipp   *:*                         LISTEN      1911/cupsd
    tcp        0      0 localhost.localdomain:rndc  *:*                         LISTEN      7262/named
    tcp        0      0 *:https                     *:*                         LISTEN      2691/httpd
    tcp        0    592 localhost.localdomain:ssh   Bertha.lan:1136             ESTABLISHED 20899/0
    tcp        0      0 localhost.localdomain:http  livebot-65-55-212-234:18963 TIME_WAIT   -
    [root@localhost ~]#
    
    getting this error when sending email

    Code:
    This is an automatically generated Delivery Status Notification
    
    Delivery to the following recipient failed permanently:
    
        [email protected]
    
    Technical details of permanent failure:
    PERM_FAILURE: Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 554 554 5.7.1 <[email protected]>: Relay access denied (state 14).
     
  17. terryoleary1981

    terryoleary1981 New Member

    I've had a slight break through, since making the change falko suggested i received email on another domain i have running on the server.

    The different between the two sites is that on the one that's working i have the domain registered on 123-reg and the A-record pointing to my server, but on spongecat i've changed the 123-reg nameserver settings to point to my webserver. So i think i may have the wrong MX record settings?

    here is what i have in IPconfig
    MX Records

    Mailserver Hostname
    www.spongecat.com www
    www.spongecat.com
    mail.spongecat.com

    I've tried adding spongecat.com as a record but it says a record or similar record already exists.

    123-reg is point to ns.spongecat.com and ns2.spongecat.com.

    Ideally i'd like to have my server as the nameserver and not rely on 123-reg....
     
  18. imnotpc

    imnotpc New Member

    A couple things you may want to look at:

    1. Both your nameservers point to the same IP address. I doubt this has anything to do with your current problem, but there is no point in assigning the secondary NS to the same server as the primary.

    2. I've seen that ISPConfig by default creates a new web domain with the www appended to the domain. This would make your default mail domain [email protected]. If you want to use [email protected] you should edit the domain and remove the www host name. You can then add a co-domain for www.spongecat.com if you wish.

    3. Your MX records have the same priority (10) and both point to the 87.194.223.165 server. Try deleting the extra record and leave one MX record with no host name which points to an A record on the server (ie. mail.spongecat.com)

    Jeff
     
  19. terryoleary1981

    terryoleary1981 New Member

    ahhhhhhh thats it i was missing the dns entry for with out the www host name..... all working now thanks to everyone who helped, there were lots of things wrong and bit by bit you've all helped!!!!

    Now whats the next problem :D
     

Share This Page