Our features site is undergoing a refresh! Be sure to explore the revamped site and discover our latest product roadmap launching here on Monday, March 18th.

A Tweak Setting to set the default mail exchanger for all WHM interfaces

Feature Importer shared this idea 13 years ago
Open Discussion

As a Reseller, I want a Tweak Setting to set the default mail exchanger for all WHM interfaces, so that the create account screen displays the default I've set in Tweak Settings.


Can we have default setting for this option not local recommended but remote or else?


In other words I'd like to see customizable default server's setting for this option.


This is a feature that has been migrated over from the cPanel Forums. All previous comments and discussions concerning this feature can be located at:

http://forums.cpanel.net/f145/mail-exchanger-auto-local-backup-remote-145717.html

Best Answer
photo

I just took a look, and unfortunately this is not possible yet, either with hooks or in the interface. I've removed this from the archive and will share it around to see if there's any more interest.

Replies (12)

photo
3

Its shocking that this isn't already a feature. Given the number of potential configurations a host might have this should be configurable.

photo
2

We use WHM internally at our University to host/manage all our websites. Of course mail is handled by other servers, so we'd like Remote Exchanger to be the default when creating accounts, which is done automatically through WHMCS. So the feature is definitely needed.

photo
2

any update on this thread? Would love to see if "Remote" is now possible to set as the default option when creating a new account (maybe even locking it down for resellers)...

photo
2

This feature is a must. Is there any way to do this at least with hooks if this is not a planned feature?

photo
2

I just took a look, and unfortunately this is not possible yet, either with hooks or in the interface. I've removed this from the archive and will share it around to see if there's any more interest.

photo
2

wow. this NEEDS to be implemented years ago. With automation of creation of accounts from software like WHMCS and the likes. Its a nightmare when you use mail servers separate to your web servers. High availability setups (separated dns, mail and web) are the basics of today. It makes it a real pain without this basic option of default remote mx being selected.

photo
1

Can't possibly express how much we need this. We don't ever do email hosting on the same server as web.

Needs to also make sure that the default applies to addon/alias domains automatically as well - we're usually pretty good at remembering to change it to Remote when adding a new account, but there isn't even an option when adding a secondary domain to an existing account.

photo
1

Still waiting (2 years later). this STILL causes issues for us regularly...

Seems like such a simple feature to implement. Shame it's taking so long...!

photo
1

I had the same issue. I still couldn't find a solution during my research. But:


I was able to solve this issue via WHMCS hook after the module was created with the WHM API. Here is my code. Optimizations are very welcome :-)


<?php
add_hook('AfterModuleCreate', 1, function($vars) {

$cpanel_user = $vars['params']['username']; //under reseller
$servername = $vars['params']['serverhostname'];
$domain = $vars['params']['domain'];

$url = 'https://' . $servername . ':2087/json-api/cpanel?cpanel_jsonapi_user=' . $cpanel_user . '&cpanel_jsonapi_apiversion=2&cpanel_jsonapi_module=Email&cpanel_jsonapi_func=setalwaysaccept&domain=' . $domain . '&mxcheck=auto';

mm_whm_curl( $url );
});

function mm_whm_curl( $url ) {

// The login data can be inserted via "require" from a non public directory too.
$whmusername = 'XXXXXX';
$whmapitoken = 'XXXXXX';

$curl = curl_init(); // Create Curl Object.
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // Allow self-signed certificates...
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); // and certificates that don't match the hostname.
curl_setopt($curl, CURLOPT_HEADER, false); // Do not include header in output
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); // Return contents of transfer on curl_exec.
$header[0] = "Authorization: whm $whmusername:$whmapitoken";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // Set the username and password.
curl_setopt($curl, CURLOPT_URL, $url); // Execute the query.
$result = curl_exec($curl);
if ($result == false) {
error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $url");
// log error if curl exec fails
}
}

photo
1

It's a serious headache and makes us (and cPanel) look very bad when we migrate a new site in and they can't receive emails from web forms because someone forgot to switch a radio button.

photo
1

Still waiting (7 years later). this STILL causes issues for us regularly...

Seems like such a simple feature to implement. Shame it's taking so long...!

photo
1

Agreed, this would be very handy.

As the majority of our customers use GSuite or Office 365,

And this simple tickbox causes us more issues than it has any business causing.

It would be great in our case, to have Automatic be the default. and for the fringe cases where we need something other than that, we could adjust as needed (per account)

Leave a Comment
 
Attach a file