So here's the problem:

![enter image description here][1]

I was wondering which OH group reacts and why? Also I have been trying to determine the structure of E based on which hydroxyl group reacts.

My thoughts are that OH in the side group can react via SN2 with the reactants, but the OH right adjacent to the ether O can react leaving a carbocation that can be stabilised by lone pair from O. This would mean SN1 and a completely different product.

Can someone please explain the correct mechanism? 

  [1]: https://i.sstatic.net/gzUC0.jpg