The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XML API - addon domains, MX records defaulting to local

Discussion in 'cPanel Developers' started by mattmindshelf, Dec 13, 2011.

  1. mattmindshelf

    mattmindshelf Member

    Joined:
    Jul 7, 2011
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    We're using the XML API to add addon domains, but the MX record is defaulting to local.

    Is there anyway it can be applied so that if MX records are detected, they default to these automatically?

    Many thanks,
    Matt
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    MX entries are set per-domain. Can you elaborate on how you are adding a MX record to point to a remote mail server at the time you are adding that domain as an addon domain so I can investigate this issue?
     
  3. mattmindshelf

    mattmindshelf Member

    Joined:
    Jul 7, 2011
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for you reply... the MX record at the minute is being left as it's default when the addon domain is being added through the XML API call. Currently, we're editing manually through cPanel or WHM to correct it to the remote mailer server, removing the local server in the process.

    I was hoping there may be a way to automate the detection of already present MX records and default to these, or even remove the auto MX record entry altogether through the zone templates? This would then allow us to manage the entry via user input at the very least...

    If this can't be done, we'll have to process through the MX functions of the XML API - just wondered if there may be a setting somewhere the stopped the auto local MX setting upon adding the addon domains.
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    The APIs here do trigger actions as if you were clicking the buttons in the cPanel GUI, so yes, just like the cPanel GUI, you could use the zone template editor to change the MX record for all newly created domains (primary, addon and parked) on that server. The domain will be added to /etc/localdomains (local) or /etc/remotedomains (remote) based on the MX record, and this is updated as needed whenever the MX entry is modified.

    What you could do is since "setting the MX entry based off the MX entries of other domains on the account" is not a feature of cPanel, you could use the APIs to grab the existing MX entries for that account and build your own algorithm to determine the best MX entry for the addon domain and set the MX entry for that addon domain accordingly after it is created.
     
Loading...

Share This Page