Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

API check alwaysaccept for local mail

Discussion in 'cPanel Developers' started by Geo Grav, Apr 26, 2017.

Tags:
  1. Geo Grav

    Geo Grav Registered

    Joined:
    Feb 7, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Victorial, Australia
    cPanel Access Level:
    Root Administrator
    Hey All.

    I have been attempting to write an script to help maintain our transport rules on our mail scanning servers and have hit a problem.

    I have configured the Remote Mail Server IPs in WHM but noted that when running the cpapi2 command utility, I noted that the result has alwaysaccept as being 0, as follows:

    Code:
    # cpapi2 --user=cpanelusername Email getalwaysaccept domain=<deleted>
    ---
    cpanelresult:
      apiversion: 2
      data:
        -
          alwaysaccept: 0
          domain: <removed>
          mxcheck: auto
      event:
        result: 1
      func: getalwaysaccept
      module: Email
    From within Cpanel itself, the Mail Routing "Automatically Detect Configuration :" says Local.

    I'm wondering if I have stumbled on an issue in the API or perhaps I have misunderstood how to configure the Extertnal mail servers.

    Version of cPanel & WHM: 64.0 (build 17) (copied from inside WHM)


    Geo
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello Geo,

    Could you let us know how you are initially changing the email routing for the domain name? For instance, I accessed "Email Routing" in cPanel and changed the routing for a domain name to "Automatically Detect Configuration : Local (recommended)". Upon doing, here's the result of the getalwaysaccept cPanel API 2 command:

    Code:
    cpapi2 --user=cptest01 Email getalwaysaccept domain=cptest01.tld
    ---
    cpanelresult:
      apiversion: 2
      data:
        -
          alwaysaccept: 0
          domain: cptest01.tld
          mxcheck: auto
      event:
        result: 1
      func: getalwaysaccept
      module: Email
    I then browsed to "Email Routing" in cPanel again, and changed the routing for the domain name to "Local Mail Exchanger". Here's the result of the getalwaysaccept cPanel API 2 command after doing this:

    Code:
    cpapi2 --user=cptest01 Email getalwaysaccept domain=cptest01.tld
    ---
    cpanelresult:
      apiversion: 2
      data:
        -
          alwaysaccept: 1
          domain: cptest01.tld
          mxcheck: local
      event:
        result: 1
      func: getalwaysaccept
      module: Email
    If "Automatically Detect Configuration" is selected, then "alwaysaccept" should be "0".

    Thank you.
     
  3. Geo Grav

    Geo Grav Registered

    Joined:
    Feb 7, 2016
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Victorial, Australia
    cPanel Access Level:
    Root Administrator
    We have been changing the mail routing via the "Mail Routing" page in the customer's cpanel.

    For us, this is no longer urgent as we have worked around it, via the mxcheck api call.

    If "alwaysaccept" is supposed to be "0" unless "Local Mail Exchanger" is selected, then I guess I have misunderstood the output of that api. I understood the returned "alwaysaccept" response attribute as being "Is this server accepting email for this domain?".

    Happy to close this ticket on that basis.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,424
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You can find some additional discussion of this topic on the following thread:

    MX Entries and the API

    Thank you.
     
Loading...

Share This Page