Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MX record + patch #4

Open
lordspace opened this issue May 30, 2016 · 1 comment
Open

MX record + patch #4

lordspace opened this issue May 30, 2016 · 1 comment

Comments

@lordspace
Copy link

Hi,

I've used your sdk. Thanks for organizing everything.

here's a fix for mx records.
https://github.com/speedster-kiev/namecheap-php-sdk/blob/master/src/Namecheap/Command/Domains/Dns/SetHosts.php

/**
         * Overload parent method to handle custom parameters
         */
        protected function _prepareParameters()
        {
            parent::_prepareParameters();

            $i = 1;
            foreach ($this->_hosts as $host)
            {
                // They've added 'EmailType' parameter which is supposed to fix custom MX servers.
                // 'EmailType' => 'MX',
                $params = array(
                    'HostName' . $i     => $host->host,
                    'RecordType' . $i   => $host->type,
                    'Address' . $i      => $host->data,
                    'MXPref' . $i       => $host->mxPref,
                    'TTL' . $i          => $host->ttl,
                );

                if ( strtoupper( $host->type ) == 'MX' ) {
                    // NC support suggested this.
                    $params['EmailType'] = 'MX';

                    // Let's keep this for consistency.
                    $params['EmailType' . $i] = 'MX';
                }

                $this->setParams($params);
                $i += 1;
            }
@lordspace lordspace changed the title MX record fix MX record + patch May 30, 2016
@speedster-kiev
Copy link
Owner

Hi, could you please make a pull request for this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants