Can we generate the Offfice 365 MX-Token needed for the MX-DNS-Record by ourselves?

Hi there
As a hosting company we programmed a DNS-zone-editor in which our customers can edit their DNS-zone. A new feature we are offering is a so-called "DNS-Template-Service", in which our customers can select predefined record templates like GoogleApps
and then trigger by one click the installation of the predefined records.
We also would like to offer them "Office 365" as a template. According to this article https://support.office.com/en-ie/article/Create-DNS-records-at-any-DNS-hosting-provider-for-Office-365-7b7b075d-79f9-4e37-8a9e-fb60c1d95166#BKMK_add_CNAME we
understand that all we need to do is to add a couple of CNAME, TXT and SRV records which is great.
However, there is also an MX record with a dynamical component (the "MX-Token") that is required:
<MX token>.mail.protection.outlook.com
We understand that this token can be fetched by the customer from their office installation. However that would break the purpose of our templating system that is designed to work like an on/off switch.
So our question is if there is any way that our system could generate this token by itself since we have knowledge of the customers domain anyway.
According to some customers who already installed those records manually we can see some patterns:
Example 1: domain1.com results in an MX with a value of
domain1-com.mail.protection.outlook.com
This is easy: just replace the dot with a hyphen.
However for domains with hyphens in the name a special conversion is made and appended on the back of the first part: 
Example 2: domain-withdash.com results in an MX with a value of domainwithdash-com01e.mail.protection.outlook.com
Example 3: dom-ainwithdash.com results in an MX with a value of domainwithdash-com0i.mail.protection.outlook.com
Example 4: doma-in-withadash.ch results in an MX with a value of domainwithdash-com01bb.mail.protection.outlook.com
So what is the algorithm for this (probably bidirectional) conversion?
Thanks for letting us know and make it easier for our customers to use office 365 with their own domain name.
Regards
Lukas
Developer @ cyon GmbH

We actually spent the last 1.5h to reverse-engineer the pattern and (hopefully) found the right answer on how these hyphen-replacements are substituted.
* This functions generates a token as done in office 365
* @return mixed|string
private function getOffice365MxToken($domain)
$delimiter = '0'; // delimiter between the domain part and the hyphen replacement part
$token = $domain;
$hyphenReplaceToken = '';
// split domain string into chunks of 4 chars
$chunkSize = 4;
$chunks = str_split($token, $chunkSize);
// transform the hyphens (their position) in the domain name to an alphanumerical character string
$skipCount = 0;
$intOfA = ord('a'); // get the decimal value of the letter 'a' as start value
foreach($chunks as $chunk){
$digit = $intOfA;
for ($i = 0; $i < $chunkSize; $i++){
if('-' === $chunk[$i]){
$digit += pow(2, $i);
if($intOfA === $digit){ // if the value is a it means no hyphen was found
$skipCount++;
continue;
if (0 !== $skipCount) {
$hyphenReplaceToken .= $skipCount;
$hyphenReplaceToken .= chr($digit);
$skipCount = 0; // rewind skip count
if(strlen($hyphenReplaceToken) > 0){
$token .= $delimiter . $hyphenReplaceToken;
$token = str_replace('-', '', $token); // remove - from domain name
$token = str_replace('.', '-', $token); // replace dots with -
return $token;
Short-hand explanation: The pattern showed that the domain string simply gets chunked into pieces of 4 chars. For each setting at which hyphen(s) can be located at the index value (seen as bit mask 0124) is added up. The resulting number we get per chunk
then can be added to starting decimal value of the letter 'a' (97) and thus gives us another letter that substitutes the hyphens locations in this chuck. If no hyphen is found, the algo simply counts for how many chunks none were find and adds this up sa a
number.
These concatenated letters + skip-numbers then result in the replacement token that gets appended on the end of the domain name (hyphens removed, dots replaced with hyphens). 
Oh and yeah, between these two parts a '0' is added as delimiter.
That's it. I hope we got it correct.
Regards
Lukas @ cyon GmbH

Similar Messages

  • I cannot sync my iphone to my macbook since the highest software upgrade on it is 10.5.8.  I cannot upgrade to the min. software necessary to upgrade to the itunes version that I need for the iphone 5!  Please help!

    I cannot sync my iphone to my macbook since the highest software upgrade on it is 10.5.8.  I cannot upgrade to the min. software necessary to upgrade to the itunes version that I need for the iphone 5!  Please help! 

    The iPhone 5 requires iTunes 10.7 or later and iTunes 10.7 requires OS X Snow Leopard (10.6.8). If your profile is correct it looks like you need to update your OS X on you Mac. You can contact Apple and purchase the software from them.

  • Software needed for the USB device, "USB Interface Controller TEST2.0"

    My mother recently acquired a digital camera. She acquired it from a second-hand store, which did not include an interface cable or software. The manual (and the USB port on the camera) indicates that a male-male USB cable is necessary for photos to be copied to the hard drive.
    I was not successful in locating such a cable at any local electronics store (I assume such a cable is now out-of-date). I purchased one from a seller on eBay. The brand is "e circuit electronics".
    Upon powering up the camera with the cable connected to it and the computer, the following message appeared:
    "Software needed for the USB device "USB Interface Controller TEST2.0" is not available. Would you like to look for the software on the Internet?"
    I clicked "Yes". After an approximate two-minute wait, another message appeared stating:
    "Software Update is not able to connect to the Internet. Please check your configuration and try again."
    I deleted, "Software Update Preferences" in the Preferences folder inside the System Folder, without solving the problem. How do I solve the issue of allowing Software Update to connect to the Internet?

    Thank you for your continued assistance, BDAqua. Unfortunately, the driver you linked to does not seem to be compatible with the camera. It is a driver for the V20 model, whereas my model would correspond to be a V2755, as referenced from a list of other Vivicam models when during a search at the Open Drivers web site.
    From the system requirement about the card reader you gave me, it will not work, as this system is running 9.1. I am hesistant to upgrade this computer to 9.2, as I have experienced system unstability with that version, with even the 9.2.2 update applied.
    In the mean time, I have e-mailed Vivitar regarding this issue, but have as of yet received a reply.
    I am not certain as to other specifics to give you, in order to solve the Software Update problem. Please elaborate.
    Yes eww, the computer in question is able to fully connect to the Internet for all that I need. I am fully aware of the difference between a computer connecting to the Internet, and a computer connecting to a digital camera. I have 15 years of Macintosh experience.

  • How can I view the login activity of my users for the past 3 months or more

    Hello,
    I need to check the login activities of my users for the past 3 months (or more). I need to monitor unauthorized access for each and everyone of them. Does anybody have an idea on how this can be done?
    Thanks for your help in advance.
    Best regards,
    Jun

    Hello,
    Thanks for the immediate response. Actually, here's what I want to do. I have a user, who always asks me to unlock his account almost every week. With this, Im worried that there might be someone trying to use his access. What I would like to do is to generate a list of all login activities for the past 3 months. The list should also contain the terminal name where the attempted login was made. This way, I should be able to track down the possible culprit.
    Thanks in advance

  • Can I use my 2TB WD My Book Essential for the Time Machine feature on the MacBook as well as two other Windows computers (one running 7 and one with Vista)?

    Can I use my 2TB WD My Book Essential for the Time Machine feature on the MacBook as well as to store information from two other Windows computers (one running 7 and one with Vista)?

    Yes you can but you need to partition the drive into at least 2 separate drives.
    To do that you need to use a Windows PC to do the first partitioning. Say you split the drive into two partitions each 1TB (or close to 1TB) each.
    Partition fand format both partitions on a Win PC as one NTFS and the other FAT32.
    Then move it to the Mac and Reformat the FAT32 partition Mac Extended (Journaled) with a GUID Partition Table.
    I have that same drive and that is what I did originally with it. I now have it just for the Mac as I have other externals for the Win systems.
    Good Luck.

  • Only one of my earbuds on my bose headphones works with my ipad, iphone and macbook- if I hold them there the right earbud will work, but for the life of me, I can't get them to both work. Why is this? And is Apple doing anything about this?

    Only one of my earbuds on my bose headphones works with my ipad, iphone and macbook- if I hold them there the right earbud will work, but for the life of me, I can't get them to both work. Why is this? And is Apple doing anything about this? While Apple's headphones have (finally) admittedly gotten better of late, I still prefer the much more comfortable headphones & sound quality that Bose makes and that I spent the money for.

    Bose Product Support

  • I have bought an iMAC second hand but when updates to purchased (not by me) Apps I cannot download the updates as it is asking for the original owners password. How can I amend this or could I delete the Apps and download new ones in place under my email

    I have bought an iMAC second hand but when updates to purchased (not by me) Apps I cannot download the updates as it is asking for the original owners password. How can I amend this or could I delete the Apps and download new ones in place under my email

    If the machine was upgraded to Lion 10.7.x by the original owner then you bought an illegal license of Lion and also of any other applications that the seller  said came pre-installed, this assumes the seller did not include original install media. In that case you need to contact the seller for the original install DVDs that came with the machine re-install up to Snow Leopard 10.6.8 and then purchase Mountain Lion ($20) and the applications you want or need. If the seller cannot come up with the original install discs then you can buy them from a nominal cost from AppleCare..

  • Before I updated my iPod I had all of the songs to an album that I bought on iTunes. After I updated my iPod I only have 5 of those songs from the album. I would like to know how I can get the rest of the songs cause I already paid for the album and I wen

    Before I updated my iPod I had all of the songs to an album that I bought on iTunes. After I updated my iPod I only have 5 of those songs from the album. I would like to know how I can get the rest of the songs cause I already paid for the album and I went on my computer and it said that I have to pay for them even though I already paid for the whole album. So what do I do?

    Sync with the same computer iTunes that you normally sync with.

  • Where can I get the Windows 7 64 bit driver for the MBP (6,2)?

    I have to install Windows 7 for work. I have my hard drive partitioned for triple boot, with Ubuntu 64 bit on one partition, and Windows 7 64 bit enterprise installed on another. Both boot fine; Ubuntu found all its drivers automatically (well done, guys!), but Windows of course cannot. Boot camp assistant refuses to download the drivers because I've already partitioned the drive. (Pardon my frustration, but that is a completely brain-damaged software design decision. -1 to apple.)
    Is there any way to get the drivers?? Even just for the wireless card?? This is unbelievably frustrating. It's 2011 - stuff is supposed to 'just work,' and playing coy little hide-the-hardware-driver games does not 'just work'.

    Alas, no dice. I was able to skip the compatibility check and run the bootcamp installer, and the 3.1 and 3.2 updates. However, I still have no wireless. The device manage shows it as an unknown network card.
    linux lspci identifies the ethernet and wifi cards as:
    02:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5764M Gigabit Ethernet PCIe (rev 10)
    03:00.0 Network controller: Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)
    the ethernet card is recognized in windows, but the BCM43224 is not.
    under linux the BCM43224 works out of the box using the standard "wl" driver with Broadcom's recently open-sourced firmware.
    But I'm having a hard time finding any other Windows drivers for it: searching broadcom's site and windows support doesn't give me anything, and google just gives me loads of what look like pay-to-download scam sites and malware. Have I entered some weird parallel reality where wifi support is better in linux than in windows? :lol: that can't be, maybe I'm not configuring something correctly.

  • Can I force the bootcamp wizard to skip looking for the bootcamp drivers?  I have already downloaded the latest drivers and loaded them on a FAT usb drive.  All I want is for bootcamp to create the partition and allow me to install windows 8 pro

    Hi Everyone,
    Can I force the bootcamp wizard to skip looking for the bootcamp drivers?  I have already downloaded the latest drivers and loaded them on a FAT usb drive.  All I want is for bootcamp to create the partition and allow me to install windows 8 pro.
    The bootcamp drivers have been downloaded from apple's website.  Filename:  BootCamp5.0.5033
    I have a iMac 27" late 2013 model.
    NOTE:  I have downloaded the drivers manually from apples support site as the bootcamp wizard fails third of the way through the download.
    Appreciate any assistance.
    Regards,
    asdutoit

    There is a missing point in this thread, and it is that the Boot Camp drivers for the Late 2013 iMac can only be downloaded from Boot Camp Assistant. The Boot Camp drivers available in the Apple site are not compatible with that iMac.
    Delete the Boot Camp drivers from the USB drive, open Boot Camp Assistant and try to download the Boot Camp drivers again. If you get a message telling you that they could not be downloaded, I would try reinstalling OS X through OS X Recovery, by holding down Command and R keys while your Mac is starting up

  • How can I get the direction handles to show up for the Position attribute?

    How can I get the direction handles to show up for the Position attribute?
    I have CS3 and I did the formentioned test and was able to make the handles work for the scale attribute but they don't seem to show when editing the position values.
    *I am in the graph editor looking at the "value graph"
    *I select the keys and convert the keys to auto bezier (I also tried the ease in and out buttons)
    *It changed the graph the way you might think (no longer linear) however the handles are not showing to edit further.
    *I also tried using the "convert vertex tool" (part of the pen tool) and still no luck getting those handles.
    *the handles only show up in the speed graph but that does me no good.
    Please help!
    THANKS 

    I don't have CS3 installed on any of my machines any more but your value graphs for position should look something like this:
    There are no handles for position in the Graph editor. You adjust the position curve by editing the motion path in the composition window. Press the G key to bring up the pen tool, then use the modifier keys Crtl/Cmnd and Alt/Option to temporarily switch between select and convert vertex to adjust the paths. Changes will be reflected in the value graphs. You will get editable handles with scale and rotation because these are not spatial properties. Spatial properties, position, Anchor Point, all XY & Z coordinates are edited in the comp window or in the layer window after revealing the properties. IOW, you edit anchor point position paths by opening up the layer window and choosing Anchor Point from the display options.
    The Manual isn't wrong. Here's a link to the live docs.

  • I have Photoshop CS 5.5 version, but I've just changed my camera and I can't open my raw files. I need for my new camera Photoshop CC and Camera Raw 8.7 version. How can I do to update the old version? Thank you

    I have Photoshop CS 5.5 version, but I've just changed my camera and I can't open my raw files. I need for my new camera Photoshop CC and Camera Raw 8.7 version. How can I do to update the old version? Thank you

    Thank you for your valuable advice. I've solved the problem right now.
    Thanks
    2015-03-16 15:06 GMT+01:00 c.pfaffenbichler <[email protected]>:
        I have Photoshop CS 5.5 version, but I've just changed my camera and
    I can't open my raw files. I need for my new camera Photoshop CC and Camera
    Raw 8.7 version. How can I do to update the old version? Thank you
    created by c.pfaffenbichler
    <https://forums.adobe.com/people/c.pfaffenbichler> in *Photoshop General
    Discussion* - View the full discussion
    <https://forums.adobe.com/message/7302535#7302535>

  • I can't find how to apply sound enhancements (EQ) for the podcasts now with iOS 6.0 update

    Dears at Apple:
    I can't find how to apply sound enhancements (EQ) for the podcasts now with iOS 6.0 update on any of my devices(iPhone 4s, iPhone Touch (4th Gen), iPad (3rd Gen). Most of the "Podcasts" I listen to are music content based and wanted to apply sound enhancements(EQ) like before when integrated with ipod function. Can you consider to "fix" this issue?
    Many Thanks!

    OK Emanuel I found a solution! I dowloaded and installed "Denon Audio" app from the iTunes store & it works great! It has an EQ you can set curves on manually or use the (few) built in pre-sets. It is a player like the Music app that comes with the iPhone, etc. but restores the EQ functionality so we can adjust the audio of PODCASTS:-) Until Apple fixes this what I consider a bug I will be using the Denon app as my default music player!

  • Recently, after cancelling the tick of a song, which is the next song after the one I am listening, in the song list, the canceled song will still run for the next song. I remember that it used not to happen like this. How can I solve this problem?

    Recently, after cancelling the tick of a song, which is the next song after the one I am listening, in the song list, the canceled song will still run for the next song. I remember that it used not to happen like this. How can I solve this problem?

    This looks like a change of behaviour in iTunes 12. Once songs are queued up to the Up Next list then they play whether ticked or not. If you want to skip certain songs already queued click the Up Next tool, then click the small X to the left of the song that appears when you hover over it.
    tt2

  • Technical Details: The website does not support encryption for the page you are viewing. Information sent over the internet withour encryption can be seen by other people while it is in transit

    Technical Details:
    The website does not support encryption for the page you are viewing.
    Information sent over the internet withour encryption can be seen by other people while it is in transit
    == This happened ==
    Not sure how often
    == started few days ago. previously never happened before.

    I was loading a website, it then stated as below, it wasnt any of the problems stated below.
    SERVER NOT FOUND
    # Check the address for typing errors such as
    ww.example.com instead of
    www.example.com
    # If you are unable to load any pages, check your computer's network
    connection.
    # If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.
    Thus i checked the Page Info, it states that:
    Security Info on page:
    '''This website does not supply ownership information.
    Connection not Encrypted.'''
    Technical Details:
    The website does not support encryption for the page you are viewing.
    Information sent over the internet withour encryption can be seen by other people while it is in transit

Maybe you are looking for