Child pages
  • UAPI Functions - Email::set_always_accept

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt
This function sets the Mail Exchanger (MX) type.


Note
titleNote:

This function only affects the cPanel configuration. You must configure the mail exchanger's DNS entry separately. 

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledDNSRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples Examples 


Panel
bgColor#FFFFFF
borderStylenone


Expand
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsess##########/execute/Email/set_always_accept?domain=example.com&mxcheck=auto&alwaysaccept=1

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Set example.com's mail exchanger type.
$set_mx_type = $cpanel->uapi(
    'Email', 'set_always_accept',
    array(
        'domain'        => 'example.com',
        'mxcheck'       => 'auto',
        'alwaysaccept'  => '1',
         )
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink

 


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Set example.com's mail exchanger type.
my $set_mx_type = $cpliveapi->uapi(
    'Email', 'set_always_accept',
    {
        'domain'        => 'example.com',
        'mxcheck'       => 'auto',
        'alwaysaccept'  => '1',
    }
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink

 


Expand
titlecPanel Template Toolkit


Code Block
languagexml
<!-- Set example.com's mail exchanger type, then display the changed values. -->
[% data = execute( 'Email', 'set_always_accept', { 'domain' => 'example.com', 'mxcheck' => 'auto', 'alwaysaccept' => '1' } ); %]
[% FOREACH q = data.checkmx.changed %]
     <p>
         [% q %]
     </p>
[% END %]
  
<!-- Get only the changed values. -->
[% execute('Email', 'set_always_accept', { 'domain' => 'example.com', 'mxcheck' => 'auto', 'alwaysaccept' => '1' } ).data.checkmx.changed %]

Include Page
LIB:_TTLink
LIB:_TTLink

 


Expand
titleCommand Line


Code Block
languagebash
uapi --user=username Email set_always_accept domain=example.com mxcheck=auto alwaysaccept=1

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{  

   },
   "data":{  
      "statusmsg":"Set Always Accept Status to: auto",
      "checkmx":{  
         "warnings":[ 
         ],
         "issecondary":0,
         "local":0,
         "remote":0,
         "detected":"local",
         "isprimary":1,
         "changed":0,
         "mxcheck":"auto",
         "secondary":0
      },
      "status":1,
      "local":0,
      "detected":"local",
      "remote":0,
      "mxcheck":"auto",
      "secondary":0,
      "results":"Set Always Accept Status to: auto"
   }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The mail exchanger's domain.

A valid domain on the cPanel account.

example.com
mxcheckstring

The mail exchanger type.

This parameter defaults to auto.

 

  • auto — Allow cPanel to determine the appropriate role.
  • local — Always accept the domain's mail.
  • secondary — Accept mail until a higher priority mail server is available.
  • remote — Do not accept mail.
auto
alwaysacceptBoolean

Whether the mail exchanger always accepts mail for the domain.

This parameter defaults to 1.

  • 1 — Always accepts mail.
  • 0 — Does not always accept mail.
1

Returns

ReturnTypeDescriptionPossible valuesExample
statusmsgstringA message of success or a reason for failure.
  • A message of success that includes the new type.
  • A string that describes an error.
Set Always Accept Status to: local
checkmxhashA hash of the mail exchanger's data.This hash includes the warnings, issecondary, local, detected, remote, isprimary, changed, secondary, and mxcheck returns. 

warnings

array

An array of warning messages, if any exist.

The function returns this value in the checkmx hash.

One or more warning messages.


Expand
titleClick to view...
Auto Detect of MX configuration not possible due to non-resolving MX entries.  Defaulting to last known setting: local.


issecondary

Boolean

Whether the mail exchanger is a secondary exchanger.

The function returns this value in the checkmx hash.

  • 1 — Secondary.
  • 0Not secondary.

0

local

Boolean

Whether the mail exchanger is a local exchanger.

The function returns this value in the checkmx hash.

  • 1 — Local.
  • 0Not local.
0

detected

string

The mail exchanger type.

The function returns this value in the checkmx hash.

  • auto
  • local
  • secondary
  • remote
auto

remote

Boolean

Whether the mail exchanger is a remote exchanger.

The function returns this value in the checkmx hash.

  • 1 — Remote.
  • 0Not remote.
0

isprimary

Boolean

Whether the mail exchanger is the primary mail exchanger.

The function returns this value in the checkmx hash.

  • 1 — Primary.
  • 0Not primary.
0

changed

Boolean

Whether a change occurred during the function.

The function returns this value in the checkmx hash.

  • 1 — Change occurred.
  • 0No change.
1

secondary

Boolean

Whether the mail exchanger is a secondary exchanger.

The function returns this value in the checkmx hash.

  • 1 — Secondary.
  • 0Not secondary.

0

mxcheck

string

The mail exchanger type.

The function returns this value in the checkmx hash.

  • auto
  • local
  • secondary
  • remote
auto
statusBooleanWhether the function succeeded.
  • 1 — Success.
  • 0 — Failure.
1
localBooleanWhether the mail exchanger is a local exchanger.
  • 1 — Local.
  • 0Not local.
0
remoteBoolean

Whether the mail exchanger is a remote exchanger.

  • 1 — Remote.
  • 0Not remote.
0
detectedstring

The mail exchanger type.

  • auto
  • local
  • secondary
  • remote
auto
mxcheckstring

The mail exchanger type.

  • auto
  • local
  • secondary
  • remote
auto
secondaryBoolean

Whether the mail exchanger is a secondary exchanger.

  • 1 — Secondary.
  • 0Not secondary.

0

resultsstringA message of success or a reason for failure.
  • A message of success that includes the new type.
  • A string that describes an error.
Set Always Accept Status to: local