Relaying mail to normal mailserver

Discussion in 'Installation/Configuration' started by trigar, Jun 6, 2006.

  1. trigar

    trigar New Member

    I have a new ISPConfig webserver set-up using the perfect setup.

    We are not an ISP, so this server will be primarily used to host our company website, intranet, plus the websites of a handful of associated businesses. Previously our websites were hosted by an external ISP. As we have not yet gone live, most of the domains continue to be hosted by that ISP, including the primary domain specified in the ISPConfig Settings. This primary domain is also our internal network domain and its "www" is our company website. Because the DNS for most of our domains continue to be handled by external ISPs, I have not yet ticked the various DNS checkboxes.

    For the domain names relating to our main company website and intranet, I wish all the email to be handled by our normal mailserver, so that emails generated by CGI scripts on the server with recipient "[email protected]" should end up in the mailbox "name" on our normal mail-server.

    For these domains I have set each site to use "External mailserver" in ISPConfig. Presumably this just does a DNS lookup for the MX record for the domain, regardless of whether the DNS is handled locally or not? I have added our mail-server to the hosts table, although I am not sure that this is strictly necessary as presumably it would be found by the normal DNS resolution.

    The problem is that the emails generated by our Intranet CGI scripts are building up in /var/mail/web1_<username> instead of being relayed to our mailserver.

    Any thoughts on how to resolve this problem? (I would like to retain the flexibility of being able to use the ISPConfig handling of mail for the other sundry domains, perhaps by Webmail or POP3.)

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Setting domains to external mailserver removes the domain from the local mailserver configuration. This means postfix will deliver these emails like any other external email to the mailserver specified in the MX record of the domain.

    You must set the the mailserver to external in the settings of all co-domains too.
  3. falko

    falko Super Moderator ISPConfig Developer

    And make sure you have MX records for all your domains that point to the correct mail server.
  4. trigar

    trigar New Member

    Thanks both. I have found the following line in syslog (yes, the first place I should have looked, sorry!):

    This particular web is our Intranet, so I have set the IP address as the LAN IP, the hostname as "intranet" and the domain as It is set, as previously stated, to use "External mailserver", which I would have expected to resolve to (which is where the primary MX record for points).

    As this web is for internal use only, I was not intending setting up DNS for the domain, so I have not created an A-record for "intranet", but have instead updated hosts tables on the machines that need to connect.

    Just in case the web having an internal IP address was causing problems, I set in /etc/hosts.

    I did try setting the web's IP address to the WAN address, but immediately the intranet was unavailable internally (and externally obviously given the lack of an A-record!).

    local-host-names looks like this:

    Any ideas?

    Many thanks.
  5. falko

    falko Super Moderator ISPConfig Developer

    You must add to /etc/postfix/local-host-names (at the end where it says that you can make edits) and restart Postfix.
  6. trigar

    trigar New Member

    Thanks Falko.

    I have now tried that, but now it is trying to deliver the email to itself and failing with:

    The email address to which it was trying to send was cjr@[I]ourprimarydomain[/I]
  7. falko

    falko Super Moderator ISPConfig Developer

    Then the DNS record (the MX record) for is not correct. It should point to your other server.
  8. trigar

    trigar New Member

    I am starting to doubt my sanity now. The problem was ever so simple, in the process of trying to resolve my previous problem Preventing http access by IP address whilst keeping our Intranet working, I had created a dummy DNS A record for our intranet (and had not created an MX record). I have now deleted this DNS entry, removed the entries in the /etc/hosts table and it now, surprise surprise, works.

    I am sorry to have wasted your time - the entries in DNS Manager seemed to neatly mirror those in ISP Manager - so the problem was not immediately apparent until after I had had my fifth double expresso!

    Thanks very much for your assistance.

Share This Page